[R] Arranging ggplot2 objects with ggplotGrob()
H
@gent@ @end|ng |rom medd@t@|nc@com
Fri Jul 24 02:36:15 CEST 2020
I am trying to arrange two plots vertically, ie plot 2 below plot 1, where I want the plots to align columnwise but have a height ratio of eg 3:1.
My attempts so far after consulting various webpages is that the following code aligns them columnwise correctly but I have, so far, failed in setting the relative heights...
g2<-ggplotGrob(s)
g3<-ggplotGrob(v)
g<-rbind(g2, g3, size = "first")
g$widths<-unit.pmax(g2$widths, g3$widths)
what would the appropriate statement for the relative heights to add here be?
grid.newpage()
grid.draw(g)
Thank you!
More information about the R-help
mailing list