我想更改ggplot Boxplot的顺序和实验室。 这是我到目前为止的内容:
ggplot(total_nr_obj_week_corr.3,aes(x=distance,y=n)) +
stat_boxplot(geom = "errorbar")+
geom_boxplot()+
facet_wrap(~year_month,strip.position = "bottom",scales = "free",nrow=2)+
scale_y_continuous(expand = c(0,0),limits = c(0,70),breaks = seq(0,80,by = 10)) +
scale_x_discrete(limits = c("0","5","10","15","20"),breaks = c("0","20"))+
theme(strip.placement="outside",strip.background = element_rect(color="black",fill="white",size = rel(1)),axis.title.x = element_text(margin = margin(t = 10,r = 0,b = 0,l = 0)),axis.title.y = element_text(margin = margin(t = 0,r = 10,l = 0)))
这是我的情节
我想更改不同构面的位置。 第一排2017年5月8日 第二排2018年5月9日
我在facet_wrap()中尝试了as.table = F,但仍然无法获得正确的顺序。
第二,我想更改标签。 在x轴下方,我想要月份(05-08 / 09),并在大标签的每一行上方,并带有年份(2017/2018)。
我搜索了数小时的所有内容,但找不到解决方案。我也尝试了fact_grid,但没有得到我想要的结果
谢谢!