0

I am trying to create a time series in R, that shows how water has changed through time. There are multiple lines that represent 11 years, and the x-axis represents months, starting in January. What I want to do is set the starting month to October, which is the start of the water year in the American Southwest. I have tried to set months to a factor and set the levels. I have tried using scale_x_dates. No luck. Any suggestions?

Data ``` SUB_BASIN CAL_YEAR MONTH MONTH_CHAR mean sd 1 Alamosa 2005 1 Jan 1.04 2.96 2 Alamosa 2005 2 Feb 3.95 3.76 >````

```ggplot(ala.all.m, aes(x= MONTH, y = mean, color = CAL_YEAR)) 
   + geom_line(lwd = 1.1)+
  ggtitle("Average Monthly ET in the Alamosa Basin") +
  ylab("Mean ET mm/month") +
  xlab("Month") +
  scale_x_continuous(breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 
  11, 12)) +
  guides(color = guide_legend(title = "Year")) 
  head(ala.all.m, 2)````

I have tried to set both MONTH_CHAR and MONTH to a factor and change the levels like so..... factor(ala.all.m[, "MONTH_CHAR"], levels=c("Oct", "Nov", "Dec", "Jan"))

Which did not work.

cheese
  • 1
  • 1

0 Answers0