|grid.arrange() and ggsave()||alobo||4/20/11 11:38 AM|
When I use ggsave() after grid.arrange(), i.e.
I do not save the grid plot but the last individual ggplot. Is there any
|Re: grid.arrange() and ggsave()||Brandon Hurr||4/20/11 12:06 PM|
I believe that it has to be done the "older way" since you're actually plotting multiple ggplot objects simultaneously and not one large object with multiple components (acceptable input for ggsave).
I'd love for someone to correct me.
|Re: grid.arrange() and ggsave()||baptiste auguie||4/20/11 1:47 PM|
The following should work with a recent version of gridExtra (>=0.8 I think).
p <- arrangeGrob(qplot(1,1), textGrob("test"))
ggsave("saving.pdf", p) # need to specify what to save explicitely
I could add the following line to grid.arrange,
so that last_plot() returns the collection of grid objects and your
|Re: grid.arrange() and ggsave()||alobo||4/28/11 12:17 AM|
You are probably right, but then we would perhaps need another function
(i.e., ggridsave()) to save what we have in the graphic window as it is in one
2011/4/20 baptiste auguie <bapt...@googlemail.com>:
|Re: grid.arrange() and ggsave()||baptiste auguie||4/28/11 1:39 AM|
Doing so would mean that gridExtra would replicate the code in ggsave
and last_plot with very minor changes, which is never good. I would
argue that a better solution would be to extract the part of ggsave
that isn't specific to ggplot2 and place it in a more generic package
that could be accessed by all grid-related packages. Not sure where
though, since R-base probably wouldn't want the burden, and ggplot2
would require it as a dependency.