p3 <- ggplot(uebersicht_jahre.df, aes(x=Jahre)) +
geom_bar(aes(y=Jahr_avM_W), stat = "identity", size=1, fill='skyblue')+
geom_line(aes(y=Jahr_sum_N, group=1), size=1, color="darkblue")+
scale_x_discrete(breaks = c("1999", "2005", "2010", "2015", "2018")) +
scale_y_continuous(name="Oberflaechenwasserstand [cm]", sec.axis = sec_axis(~./1,name="Niederschlag [mm]"))+
labs(x="Jahre", tag = "d") +
theme(axis.title = element_text(size = 10),
axis.text = element_text(size=8),
panel.grid = element_blank(),
plot.title = element_text(size=12, face = 'bold'))
p4 <- ggplot(uebersicht_jahre.df, aes(x=Jahre)) +
geom_bar(aes(y=Jahr_avM_W), stat = "identity", size=0.1, fill='skyblue')+
geom_line(aes(y=Jahr_avM_Wetter, group=1), size=1, color="red")+
scale_x_discrete(breaks = c("1999", "2005", "2010", "2015", "2018")) +
scale_y_continuous(name="Oberflaechenwasserstand [cm]", sec.axis = sec_axis(~./1,name="Temperatur [C°]")) +
labs(x="Jahre", tag = "d") +
theme(axis.title = element_text(size = 10),
axis.text = element_text(size=8),
panel.grid = element_blank(),
plot.title = element_text(size=12, face = 'bold'))
jpeg(filename = "ggplot.jpeg",width = 1000, height = 1000)
grid.arrange(p3, p4, nrow=2)
dev.off()
Error shows:
Error in check_aesthetics()
:
! Aesthetics must be either length 1 or the same as the data (240): y
Run rlang::last_error()
to see where the error occurred.
Thank you for every answer to solve the Problem.