【发布时间】:2017-07-08 19:28:49
【问题描述】:
当使用coord_fixed() 更改形状时,有没有办法移除 ggplot2 绘图周围的空白?我希望将上方和下方的空白区域裁剪掉,以便仅保留绘图区域和轴标签。我在 R markdown 文件中渲染绘图输出而不保存。
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
p + coord_fixed(ratio = 1)
下面的代码产生了如下图:
【问题讨论】:
-
你想要这样的东西吗?
p + coord_equal() + theme(aspect.ratio = 1)
标签: r ggplot2 whitespace margin crop