Skip to content

gridExtra-arrangeGrob

4 messages · Felipe Carrillo, John Kane, David Winsemius

#
?Hi;The code below used to work on my older version of gridExtra but doesn't work with the new version. Could someonegive me a hint on how to translate this code to the new version of gridExtra code? Thank you beforehand.
p1?<- ggplot(iris,aes(Sepal.Length,? Petal.Length, colour=Species)) +
geom_point() + theme_bw() + theme(legend.position='top')

?grid.arrange(p1, arrangeGrob(p1,p1,p1, heights=c(0.33, .33,.33), ncol=1), ncol=2)
?#Create 2 columns with different width using the 'widths' argument in the grid.arrange call
? grid.arrange(p1, arrangeGrob(p1,p1,p1, heights=c(0.33, .40,.27), ncol=1), ncol=2,widths=c(1.25,0.75))
p <- rectGrob()??
?grid.arrange(p, arrangeGrob(p,p,p, heights=c(0.33, .33,.33), ncol=1), ncol=2)
#
I'm not sure what the problem is but, if nothing else, it looks like you need to do 
library(grid)
It may be that an early version of ggplot2 or gridExtra was automatically loading grid and it no longer does.?
On Monday, January 9, 2017 1:08 AM, Felipe Carrillo via R-help <r-help at r-project.org> wrote:
?Hi;The code below used to work on my older version of gridExtra but doesn't work with the new version. Could someonegive me a hint on how to translate this code to the new version of gridExtra code? Thank you beforehand.
p1?<- ggplot(iris,aes(Sepal.Length,? Petal.Length, colour=Species)) +
geom_point() + theme_bw() + theme(legend.position='top')

?grid.arrange(p1, arrangeGrob(p1,p1,p1, heights=c(0.33, .33,.33), ncol=1), ncol=2)
?#Create 2 columns with different width using the 'widths' argument in the grid.arrange call
? grid.arrange(p1, arrangeGrob(p1,p1,p1, heights=c(0.33, .40,.27), ncol=1), ncol=2,widths=c(1.25,0.75))
p <- rectGrob()??
?grid.arrange(p, arrangeGrob(p,p,p, heights=c(0.33, .33,.33), ncol=1), ncol=2)

??? [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
#
The lattice library attaches the grid functions via a namespace mechanism but it does not actually load the package. That meant that attempts to use grid functions from the console would fail. Perhaps this is also the practice of the ggplot2 authors? In any event, the grid.arrange and arrangeGrob functions are not from grid, but rather from gridExtra, which I am not seeing being loaded.
#
I am not sure if something was wrong with my gridExtra installation or grid but after uninstall/re-install of the packages (and reboot) the code is working properly. Thank you all.?
On Monday, January 9, 2017 9:51 AM, David Winsemius <dwinsemius at comcast.net> wrote:

            
The lattice library attaches the grid functions via a namespace mechanism but it does not actually load the package. That meant that attempts to use grid functions from the console would fail. Perhaps this is also the practice of the ggplot2 authors? In any event, the grid.arrange and arrangeGrob functions are not from grid, but rather from gridExtra, which I am not seeing being loaded.