[R] saving plots as objects?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Feb 27 08:59:53 CET 2004
On Fri, 27 Feb 2004, Deepayan Sarkar wrote:
> On Friday 27 February 2004 01:22, Prof Brian Ripley wrote:
> > On Thu, 26 Feb 2004, Deepayan Sarkar wrote:
> > > On Thursday 26 February 2004 14:47, Rajarshi Guha wrote:
> > > > Hi I had two questions regarding plots:
> > > >
> > > > * Is there are way to save a plot in the form of an object such that
> > > > it could be displayed/modified later?
> > >
> > > Depends on what you want to do. Probably not for regular (base) plots.
> > I think ?recordPlot does this, at least to allow plots to be saved,
> > displayed again and added to.
> Ah, I didn't know that.
> > > The
> > > grid package has a concept of objects that can be edited (before
> > > and/or after plotting them). Functions in the lattice package produce
> > > objects that may be close to what you want. They are not plots
> > > themselves, but rather a self-contained description of a plot (in the
> > > sense that they contain the data as well as instructions on how to
> > > plot it). The data part cannot be easily changed, but almost
> > > everything else can be manipulated before plotting.
> > AFAIK that internal description is not documented and there are no
> > end-user tools for doing the manipulation. Can you please point us to
> > details? I suspect nothing can _easily_ be changed by end-users at
> > present.
> There has always been an update() method that's supposed to be used for
> this. No one uses it much, and it probably has a few bugs (but should be
> improved in time for R 1.9.0). From ?xyplot:
> An object of class ``trellis''. The `update' method can be used to
> update components of the object and the `print' method (usually
> called by default) will plot it on an appropriate plotting device.
Ah, I see. It cannot change the panel function, for example, indeed none
of the things I was thinking about. I had thought update() recalculated
the plot, so I've learned something, thank you.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help