# Wir nutzen konsequent 'sprit_data' (nicht 'df'), um Konflikte mit Funktionen zu vermeiden
p1 <- ggplot(sprit_data, aes(x = Zeit)) +
geom_line(aes(y = E5, color = "Super E5"), size = 0.8) +
geom_line(aes(y = E10, color = "Super E10"), size = 0.8) +
scale_color_manual(values = c("Super E5" = "#d7191c", "Super E10" = "#2b83ba")) +
labs(title = "Spritpreise (Okt 2025 - Jan 2026)",
y = "Preis in €",
x = "Datum",
color = "Kraftstoffart") +
theme_minimal()
ggplotly(p1)
station_summary <- sprit_data %>%
group_by(StationE5) %>%
summarise(
Checkins = n(),
`Ø Preis E5` = round(mean(E5), 3),
`Min Preis` = min(E5),
`Max Preis` = max(E5)
) %>%
arrange(`Ø Preis E5`)
datatable(station_summary,
colnames = c("Tankstelle", "Anzahl Messungen", "Ø Preis E5", "Min (€)", "Max (€)"),
options = list(pageLength = 5, language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/German.json')))
w_plot <- sprit_data %>%
group_by(Wochentag) %>%
summarise(Schnitt = mean(E5)) %>%
ggplot(aes(x = Wochentag, y = Schnitt, fill = Schnitt)) +
geom_col() +
scale_fill_gradient(low = "#4daf4a", high = "#e41a1c") +
coord_cartesian(ylim = c(min(sprit_data$E5) - 0.02, max(sprit_data$E5) + 0.02)) +
labs(title = "Durchschnittspreis E5 nach Wochentag",
y = "Preis in €", x = "") +
theme_minimal() +
theme(legend.position = "none")
w_plot
