有没有办法控制ggplot中facets上的条纹大小?我尝试使用strip.background=element_rect(size=n)
,但据我所知它实际上没有起作用。这是可能的吗?
将图表手动转换为gtable让您可以调整strip的高度。
library(ggplot2)
library(gtable)
d <- ggplot(mtcars, aes(x=gear)) +
geom_bar(aes(y=gear), stat="identity", position="dodge") +
facet_wrap(~cyl)
g <- ggplotGrob(d)
g$heights[[3]] = unit(1,"in")
grid.newpage()
grid.draw(g)
\n
)以增加它们的大小。 - joranelement_rect
中,size 指的是边界线的点大小,它实际上并不能帮助您使矩形变得更大或更小。 - Gregor ThomasggplotGrob
TableGrob
,然后查找strip_
grobs 并修改height
元素是否可行?我现在没有时间测试,但我知道其他人也会在 grob 层面上进行调整。 - hrbrmstr