grid.arrange from gridExtras exiting with "only 'grobs' allowed in 'gList'" after update
It is because grid.arrange
does not have a main
parameter anymore (seems to have been eliminated around Summer 2015 with the 2.0.0 release) and thus thinks that the main=
parameter must be a grob. To replace the main
, you can use the top
parameter now (as well as a bottom
, left
, and right
).
So this works for example:
library(ggplot2)
p1 = qplot(1:10,rnorm(10))
p2 = qplot(1:10,rnorm(10))
library(gridExtra)
grid.arrange(p1, p2, ncol=2,top="Main Title")
The message is a bit confusing, that is because it looks at all the parameters it does not know and assumes they might be grobs
(graphical objects) that it can plot. A confusing error message like this is the price you pay for that flexibility.
Note: - if you have a lot of grobs
you should consider packing them all into a list and use the form:
grid.arrange( grobs = list(p1,p2,...),...
Here is what that above code results in: