我使用以下代码更改构面上条带背景的高度。但是第二排似乎效率不高。
library(reshape2)
library(grid)
library(gtable)
library(ggplot2)
gp <- ggplot(data = tips, aes(x = total_bill, y = tip/total_bill)) + geom_point() + facet_wrap( ~ day, ncol = 2)
g <- ggplotGrob(gp)
g$heights[[3]] = unit(0.3, 'in')
g$grobs[[6]]$heights <- g$grobs[[7]]$heights <- g$grobs[[8]]$heights <- g$grobs[[9]]$heights <- unit(1, 'native')
grid.draw(g)
答案 0 :(得分:1)
g$heights[c(3,7)] <- unit(0.3, 'in')