我不知道如何将标签left
或right
一边放在facet_grid
条的一侧。在facet_grid的条纹外面放置标签
作为一个重复的例子,我想先从这个例子
library(ggplot2)
ggplot(mtcars, aes("", hp)) +
geom_boxplot(width=0.7, position=position_dodge(0.7)) +
theme_bw() +
facet_grid(. ~ vs + am + carb,switch = 'both',labeller = label_both) +
theme(panel.spacing=unit(0.2,"lines"),
strip.background=element_rect(color="grey30", fill="grey90"),
panel.border=element_rect(color="grey90"),
axis.ticks.x=element_blank())+
#strip.placement="outside") +
labs(x="")
我找的情节;
不要以为可以做到的 “直接”。试着在第二个图表中绘制图形,然后调用类似'grid.text(“vs”,x = 0.98,y = 0.1)',尽管你必须摆弄数字以准确地将它放在需要的地方。 –
例如https://stackoverflow.com/a/29594608/2706826 –