ggplot:多层x轴

时间:2017-07-05 21:08:29

标签: r ggplot2 axis-labels

我正在尝试制作一个盒子图表,显示随着时间推移的鸡蛋计数,将年份分为干燥和阴雨季节。下面的图表几乎就在那里,但不是继续月份系列,而是在雨季重新开始月份名称。它应该是11月至5月,然后是6月至10月。我错过了什么?

   ggplot(data=eggcounts3, mapping=aes(x=monthegg, y=Eggs, color=as.factor(monthegg)))+
      geom_boxplot(width=0.9)+
      ylim(0,12001)+
      xlab("Time of Year")+
      guides(color=FALSE)+
      ylab("Fecal Egg Count")+ 
      scale_x_discrete(labels=c("Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct"))+
      facet_wrap(~NewSeason, strip.position = "bottom", scales = "free_x") +
      theme(strip.background = element_blank(),strip.placement = "outside",axis.text.x = element_text(face="bold"))

Graph with wrong months

0 个答案:

没有答案