I am making many line charts and I need the y axis to start at 0, but I want the max to be the max of the data, or whatever it needs to be to fit the data. I have this code:
ggplot(MonthView1, aes(x=as.factor(MONTH), y=Count,colour=as.factor(YEAR))) +
geom_line(aes(group=as.factor(YEAR))) + geom_line(data=Statistics1,
aes(y=Avg, group=1),color="Black",size=0.75)+xlab("Month")+ggtitle("Count of
Reported Non-Weather Claims, Excluding No
Pays")+scale_color_manual(values=c("red3", "orange3", "yellow4", "Green2" ,
"lightseagreen","darkgreen", "skyblue3", "midnightblue", "darkorchid4",
"maroon4", "hotpink2" ))+theme(axis.text.y=element_text(size=12),axis.text.x=element_text(size=12))+scale_x_discrete(expand = c(0, 0))+scale_y_continuous(limits = c(0,200),expand = c(0, 0))+labs(color="Year")
The
scale_y_continous(limits = c(0,200)
works, but I do not want to keep changing the max value when the data changes. Also, I am using two dataframes for this graph, so how do I make it the max of all data, not just one dataframe? Thank you.