Rodolphe LAMPE Rodolphe LAMPE - 1 year ago 136
R Question

How to combine two ggplots with one rotated?

How do you combine two ggplots g1 and g2 with one on the left and one on the right, 90° rotated (only the right one) ?

I have already looked at grid and gridExtra package but I don't find my way through all of this.

Answer Source

Some adjustments might be necessary for the width and height of the second plot, but this seems to work:

p <- qplot(1:10)

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download