【发布时间】:2017-07-31 23:52:32
【问题描述】:
我想知道如何在facet_grid 条带的一侧放置标签left 或right。
作为一个可重现的例子,我想从这个例子开始
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)的方法,但您必须调整数字才能将其准确地放在需要的位置。
标签: r ggplot2 facet-grid