我有几个多面的直方图(通过下面的命令获得),它们很好地一个接一个地绘制。我想增加它们之间的间距,但是它们很紧。
我查看了doc,但未找到此参数。
提前致谢。
qplot (Happiness.Level, Number.of.Answers, data=mydata, geom="histogram") + facet_grid (Location ~ .)
答案 0 :(得分:131)
使用theme功能:
library(grid)
p + theme(panel.spacing = unit(2, "lines"))
答案 1 :(得分:6)
只是添加到@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"))