ggplot facet_grid 现在切换左条带和刻度线

ggplot facet_grid now switches left strip and tick marks

我正在使用 ggplot 来说明一组图的结果。几个月前,当我第一次制作我的数字时(在 ggplot 的最新升级之前)我能够做到这一点:

但是,现在我必须重新制作我的数字以重新提交,并且现在我已经更新到最新版本的 ggplot,这就是完全相同的代码将产生的结果:

作为参考,这是我使用的代码

#################### Set ggplot theme

themebar = theme(axis.text.x = element_text(face="bold", color="black", size=rel(1), angle=0),
             axis.title.x = element_text(size = rel(1.1), angle = 0, face="bold"),
             axis.text.y = element_text(face="bold", color="black", size=rel(1), angle=0), 
             axis.title.y = element_text(size = rel(1.1), angle = 90, face="bold"),
             panel.border = element_rect(linetype = "solid", colour = "black", fill=NA),
             legend.text = element_text(size = rel(0.7), face = "bold", lineheight=0.8),
             legend.position = "bottom",
             legend.box = "vertical",
             legend.background = element_rect(fill=NA, size=0.25, linetype="solid", colour ="black"),
             legend.title = element_blank(),
             panel.grid.major = element_line(colour="gray", linetype = "dotted"),
             panel.background = element_rect(fill = NA),
             strip.background = element_rect(fill = NA),
             strip.text = element_text(size=rel(1), face="bold")) # , strip.text = element_blank()

## labeller
alt_sites = c(`Kolkata` = "A",  `Delhi` = "B", `Dong Thap` = "C", `Kibera` = "D", `Lwak` = "E")

ggplot(dat_2ceac_main, aes(x=wtpdol, y=prob, group=Intervention, colour=factor(Intervention))) + # 
 geom_line(size=1) +
 geom_vline(aes(xintercept = 0), size=0.75, linetype=c("dotted"), show.legend=F) +
 geom_vline(aes(xintercept = vce), data=threshold, linetype=c("dashed"), show.legend=F) + 
 geom_vline(aes(xintercept = ce), data=threshold, linetype=c("dotdash"), show.legend=F) +
 facet_grid(site~., switch="y", labeller=labeller(site=as_labeller(alt_sites))) +  
 themebar + theme(strip.text.y = element_text(angle = 180, vjust=1), strip.switch.pad.grid=) +
 scale_colour_manual(values=Set0, labels=c("No intervention", "Routine")) + # scale_colour_hue(c=120,l=45) +
 scale_x_continuous(limits=c(0, 20000), labels=comma) +
 scale_y_continuous(limits=c(0, 1)) + 
 guides(colour = guide_legend(nrow = 1, byrow=F)) + # title = "Intervention", title.position = "top", 
 ylab("Probability Cost-Effective") +
 xlab("Willingness-to-pay per \ndisability-adjusted life-year averted, I$")

不看示例数据很难调试,但请尝试将其添加到 themebar 的末尾:

+ strip.placement = "outside"