[英]Manually placing facets in facet plot ggplot
If, for example, you have 7 panels and you specify facet_wrap(~model, nrow = 3)
ggplot will default to a 3x3x1 layout.例如,如果您有 7 个面板并指定
facet_wrap(~model, nrow = 3)
ggplot 将默认为 3x3x1 布局。 Is it possible to get ggplot to do 3x2x2 (or 2x2x3, etc.)?是否可以让 ggplot 执行 3x2x2(或 2x2x3 等)?
You can use ggh4x
to specify the design
of your facet:您可以使用
ggh4x
来指定您的构面design
:
library(ggh4x)
design = matrix(c(1, 1, 2, 2, 3, 3,
4, 4, 4, 5, 5, 5,
6, 6, 6, 7, 7, 7),
3, 6, byrow = TRUE)
ggplot(mpg, aes(displ, hwy, colour = as.factor(cyl))) +
geom_point() +
facet_manual(vars(class), design = design)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.