Hello, I created several plot with ggplot2 dev mode.
Now I want to combine the plots in a grid e.g. 2x2 with a fixed size of the output. What I am doing at the moment is: grid.newpage() pushViewport(viewport(layout = grid.layout(nrow=2, ncol=2, widths = unit(c(7.5,6.5), "cm"), heights = unit(rep(5, 2), "cm")))) print(plot1, vp = viewport(layout.pos.row = 1, layout.pos.col = 1)) print(plot2, vp = viewport(layout.pos.row = 1, layout.pos.col = 2)) print(plot3, vp = viewport(layout.pos.row = 2, layout.pos.col = 1)) print(plot4, vp = viewport(layout.pos.row = 2, layout.pos.col = 2)) This is working well so far. The y-axis are for all plots the same so I'd like to have a global y-axis title on the left side. How can that be done using my approach? I also would like to add a global vertical legend for my plots below all plots. The legend should show the to different symbols (same as for the single plots (ggplot2)). I also don't know how to do that. I know that there is the function grid.arrange which can do both things but this isn't working because I am in the dev mode of ggplot. Then I get the error: Error: could not find function "ggplotGrob. I load my libraries the following way: 1) import data 2) load library(gridExtra) 3) load library(devtools) dev_mode(TRUE) library(ggplot2) library(reshape2) 4) produce plots 5) arrange the plots. So what is the best way to proceed? Should I stay with the grid.layout approach and can I get there a global legend and a global y axis title? Or how can I use grid.arrange, define the position of the gobal legend and set the single plot to a fixed size? I hope that wasn't to complicated... /Johannes -- ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.