我可以创建一个像这样的刻面图,有3个垂直堆积的图:
ggplot(iris, aes(Petal.Length)) + stat_bin() + facet_grid(Species ~ .)
Run Code Online (Sandbox Code Playgroud)
是否可以将标签移动到每个图形的顶部,就像我在水平堆叠时一样facet_grid(. ~ Species)?
我想要的原因是我的绘图是长时间序列图,所以我想要每个绘图的全宽,但是每个绘图的标签(基本上用作解释刻面的标题)太长而不适合小标题右侧的标签区域.
And*_*rie 13
是.使用facet_wrap而不是facet_grid并确保也指定参数ncol=1:
ggplot(iris, aes(Petal.Length)) + stat_bin() + facet_wrap(~Species, ncol=1)
Run Code Online (Sandbox Code Playgroud)
