[R] Problem with gridExtra
Lorenzo Isella
lorenzo.isella at gmail.com
Thu Aug 27 21:33:16 CEST 2015
Dear All,
Please consider the snippet at the end of the email, largely based on
what you find here
http://bit.ly/1ND6MGa
When I run it, I get this error
Error in arrangeGrob(p, sub = textGrob("Footnote", x = 0, hjust =
-0.1, :
could not find function "textGrob"
However, the code runs on another machine I own. I suppose something
must have changed in the gridExtra library but right now I am banging
my head against the wall.
This is my sessionInfo()
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux stretch/sid
locale:
[1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C
[3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8
[5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8
[7] LC_PAPER=en_GB.utf8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] gridExtra_2.0.0 ggplot2_1.0.1
loaded via a namespace (and not attached):
[1] Rcpp_0.11.6 digest_0.6.8 MASS_7.3-43 grid_3.2.2
[5] plyr_1.8.3 gtable_0.1.2 magrittr_1.5 scales_0.3.0
[9] stringi_0.5-5 reshape2_1.4.1 proto_0.3-10 labeling_0.3
[13] tools_3.2.2 stringr_1.0.0 munsell_0.4.2
colorspace_1.2-6
Any suggestion is appreciated.
Cheers
Lorenzo
##############################################################
library(ggplot2)
toyota <- mpg[which(mpg$manufacturer == 'toyota'), ]
p <- ggplot(toyota, aes(displ, hwy)) + facet_wrap(~ class, ncol = 2) +
geom_point(aes(size=cyl))
print(p)
library(gridExtra)
g <- arrangeGrob(p, sub = textGrob("Footnote", x = 0, hjust = -0.1,
vjust=0.1, gp = gpar(fontface = "italic", fontsize = 18)))
ggsave("/Users/Alan/Desktop/plot_grid_extra.png", g)
More information about the R-help
mailing list