I'm trying to make a graph to depict a population over a period of time. However, the dates are not in chronological order. In the imported CSV the dates are all correct and in order. However, once the code below is run, the graph presented does not have the dates in the correct order. The starting date is in the middle and the ending date is on the left of the starting date. Is there any way I can fix it?
sumc <- aggregate(ex2$C, bu=list(ex2$Date, ex2$Temp), FUN=sum)
colnames(sumc) <- c("Date", "Temperature", "Individuals")
ggplot(data= sumc, aes(x=Date, y=Individuals, group=Temperature, colour=Temperature )) + geom_line() + theme(plot.title = element_text(face="bold")
,plot.background = element_blank()
,panel.background = element_blank()
,panel.grid.major = element_blank()
,panel.grid.minor = element_blank()
,panel.border = element_blank()
,axis.line = element_line(colour="black", size=1)
,axis.text.x = element_text(colour="black", size=10)
,axis.text.y = element_text(color="black", size=8)
,axis.title.x = element_text(colour="black", size=10, face="bold", vjust=-.2)
,axis.title.y = element_text(color="black", size=10, face="bold", vjust=1.2)
,legend.text=element_text(size=8))
This image is the population over time. But as you can see the dates on the x axis are incorrect and off:
See Question&Answers more detail:os