如何增加刻面图之间的间距?

我有几个刻面直方图(通过下面的命令获得) ,它们被很好地绘制在一个下面另一个。我想增加它们之间的间距,但是它们太紧了。

我查看了 医生,但没有找到这个的参数。

qplot (Happiness.Level, Number.of.Answers, data=mydata, geom="histogram") + facet_grid (Location ~ .)
98566 次浏览

使用 主题函数:

library(grid)


p + theme(panel.spacing = unit(2, "lines"))

参见: Ggplot2生成的切片图

只要添加到@rcs 响应:

# Change spacing between facets on both axis
p + theme(panel.spacing = unit(2, "lines"))


# Change horizontal spacing between facets
p + theme(panel.spacing.x = unit(2, "lines"))


# Change vertical spacing between facets
p + theme(panel.spacing.y = unit(2, "lines"))