如何组合两个ggplots与一个旋转?

时间:2016-09-26 21:35:23

标签: r ggplot2 gridextra r-grid

如何将两个ggplots g1和g2组合在一起,左边一个,右边一个,旋转90°(只有右边一个)?

我已经查看了grid和gridExtra包,但是我找不到所有这些。

1 个答案:

答案 0 :(得分:1)

对于第二个图的widthheight,可能需要进行一些调整,但这似乎有效:

p <- qplot(1:10)

library(grid)
grid.newpage()
print(p, vp=viewport(0, 0, width = unit(0.5, "npc"), just = c('left', 'bottom')))
print(p, vp=viewport(0.5, 0, angle = 90, height = unit(0.8, "npc"), width = 0.55, just = c('left', 'top')))

enter image description here

相关问题