You can assign the ggplot call to a variable, something that is done in the
help files of the function very often. Perhaps it would be clearer if you
told us what you're trying to do?
Shot in the dark, but maybe you're looking for `ggsave` which saves the
last plot called.
> To post: email ggplot2@googlegroups.com
> To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
Sorry if I was not clear enough before. ggsave sinks the plot to a connection (for example a file or url or the clipboard), and the example objects in the help files are gg/ggplot objects. These are not grid data (pixels on a matrix), not until the plot is rendered into a connection. I want to capture the grid data, not the ggplot object. Does that make sense?
#this would not work, because the print function is directing the output to the default stdout(), #in this example a new window in the console, so the output (the plot data) is not captured by capture.output()
z<-capture.output(print(p))
(z)
On Tuesday, November 20, 2012 1:12:38 AM UTC-8, Roman Luštrik wrote:
> You can assign the ggplot call to a variable, something that is done in > the help files of the function very often. Perhaps it would be clearer if > you told us what you're trying to do?
> Shot in the dark, but maybe you're looking for `ggsave` which saves the > last plot called.
> Cheers,
> Roman
> On Tue, Nov 20, 2012 at 3:03 AM, Leo <leoa...@gmail.com <javascript:>>wrote:
>> Hi there,
>> Is it possible to re-direct the plot of the ggplot object to a
>> variable? Something that would work like capture.output()?
So you want to send the plot to a file? look at the device functions like
jgep, png, pdf, bitmap, etc. You can read the plot back into R as a matrix
or array using various tools like the png package or the EBImage package
from bioconductor.
On Tue, Nov 20, 2012 at 6:34 PM, Leo <leoasa...@gmail.com> wrote:
> Hi Roman,
> Sorry if I was not clear enough before. ggsave sinks the plot to a
> connection (for example a file or url or the clipboard), and the example
> objects in the help files are gg/ggplot objects. These are not grid data
> (pixels on a matrix), not until the plot is rendered into a connection. I
> want to capture the grid data, not the ggplot object. Does that make sense?
> #this would not work, because the print function is directing the output
> to the default stdout(),
> #in this example a new window in the console, so the output (the plot
> data) is not captured by capture.output()
> z<-capture.output(print(p))
> (z)
> Leo
> On Tuesday, November 20, 2012 1:12:38 AM UTC-8, Roman Luštrik wrote:
>> You can assign the ggplot call to a variable, something that is done in
>> the help files of the function very often. Perhaps it would be clearer if
>> you told us what you're trying to do?
>> Shot in the dark, but maybe you're looking for `ggsave` which saves the
>> last plot called.
>> Cheers,
>> Roman
>> On Tue, Nov 20, 2012 at 3:03 AM, Leo <leoa...@gmail.com> wrote:
>>> Hi there,
>>> Is it possible to re-direct the plot of the ggplot object to a
>>> variable? Something that would work like capture.output()?
> To post: email ggplot2@googlegroups.com
> To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
Thank you all for the replies. To Greg, yes, I can always do that, but
reading and writing to a disk takes time, especially when producing
many plots. I have tried and timed it for my needs and it just takes
too long. To ADP, plot.object is a ggplot object, not a grid.
On Nov 22, 4:21 am, ADP <nicholasehamil...@gmail.com> wrote: