考虑以下示例?ggplot2::facet_grid:
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p + facet_grid(vars(drv), vars(cyl))
Run Code Online (Sandbox Code Playgroud)
我想要实现的是 facet-labeling strips 和实际图之间的较小偏移/空白。结果看起来(没有gimp参与):

是否可以使用ggplot2或其任何衍生软件包?
感谢您的任何见解。
有一个选项strip.switch.pad.grid,但只有在激活switch参数时才有效
library(ggplot2)
theme_set(theme_bw(base_size = 14))
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p + facet_grid(vars(drv), vars(cyl),
switch = 'y') +
theme(strip.placement = 'outside') +
theme(strip.switch.pad.grid = unit('0.25', "cm"))
Run Code Online (Sandbox Code Playgroud)

由reprex 包(v0.2.1)于 2019-05-15 创建
跟进上面@Tung 的分析器(以及一些无视文档的实验),我让它开始工作:
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")
Run Code Online (Sandbox Code Playgroud)
还有……多多!:
| 归档时间: |
|
| 查看次数: |
490 次 |
| 最近记录: |