I am having issues. I created a bargraph using ggplot2 to plot rainfall. But I cannot get the right scale on the y axis and neither can I add the mean over the years. All the missing values were removed from the data set. The bars are correct though, but the y scale are showing 1 and 2. I tried to change "summary" for "identity", but it does not work. I have tried to manually change the y axis values, but it does not work. Please help
str(dat)
dat$Year <- as.character(dat$Year)
dat$Month <- factor(dat$Month)
dat$Day <- factor(dat$Day)
dat$Rainfall <- as.numeric(dat$Rainfall)
ggplot(data=dat, aes(x=Year, y=Rainfall)) +
geom_bar(stat="summary", na.rm=TRUE,width= 0.5, position=position_dodge(width=0.8), fill="orange") +xlab("Rainfall between 1998 - 2023") +
scale_y_continuous(name="Rainfall (mm)",)+
geom_hline(yintercept = mean(dat$Rainfall), linetype ="dashed", linewidth = 1)+
ggtitle("Rainfall at Coonamble Airport between 1998 and 2023")