开发者

ggplot: How to increase spacing between faceted plots?

I have several faceted histograms (obtained with the command below) which are nicely plotted one u开发者_StackOverflownder the other. I would like to increase the spacing between them, however, they are tight.

I looked at the doc but didn't find a parameter for this.

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


Use the theme function:

library(grid)

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

See also here: Slicing plots generated by ggplot2


Just to add to @rcs response:

# 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"))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜