从多面画布上分离`facet_grid`条带吗? [英] Distancing `facet_grid` strips from the faceted canvas?
本文介绍了从多面画布上分离`facet_grid`条带吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请考虑?ggplot2::facet_grid
中的以下示例:
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p + facet_grid(vars(drv), vars(cyl))
结果如下图所示
我想实现的是在刻面标签strip
与实际图之间有一个较小的偏移/空白.结果看起来(没有gimp
参与):
What I would like to achieve is a minor offset/white space between the facet-labeling strip
s and the actual plots. The result would look (sans the gimp
involvement):
是否可以使用ggplot2
或其任何派生软件包?
Is that possible using ggplot2
or any of its derivative packages?
谢谢您的见解.
推荐答案
在上面@Tung的分析工具(以及一些忽略文档的实验)之后,我开始使用它了:
Following up on @Tung's anser above (and some documentation-ignoring experimentation), I get it to work:
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p +
facet_grid(vars(drv), vars(cyl)) +
theme(strip.switch.pad.grid = unit(0.2, "cm"), strip.placement = "outside")
然后……多田!:
这篇关于从多面画布上分离`facet_grid`条带吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文