Re: [R] Plots Without Displaying

From: Lothar Botelho-Machado <r-help_at_botelho-machado.de>
Date: Thu 17 Aug 2006 - 23:55:01 EST

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thank you,

It seems that a list of plots is just possible using lattice plots. But that's a good keyword for me to look for, I appreciate your help!

Lothar

Christos Hatzis wrote:
> Yes, you can do that for lattice-based plots. The functions in the lattice
> package produce objects of class "trellis" which can be stored in a list and
> processed or updated at a later time:
>
> library(lattice)
> attach(barley)
> plotList <- list(length=3)
> plotList[[1]] <- xyplot(yield ~ site, data=barley)
> plotList[[2]] <- xyplot(yield ~ variety, data=barley)
> plotList[[3]] <- xyplot(yield ~ year, data=barley)
>
> plotList
> plotList[[3]] <- update(plotList[[3]], yaxis="Yield (bushels/acre)")
> print(plotList[[3]])
>
> Obviously, you can store any lattice-based plot in the list.
>
> HTH.
>
> -Christos
>
> Christos Hatzis, Ph.D.
> Nuvera Biosciences, Inc.
> 400 West Cummings Park
> Suite 5350
> Woburn, MA 01801
> Tel: 781-938-3830
> www.nuverabio.com
>
>
>
> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Lothar
> Botelho-Machado
> Sent: Wednesday, August 16, 2006 4:49 PM
> To: r-help@stat.math.ethz.ch
> Subject: Re: [R] Plots Without Displaying
>
> Prof Brian Ripley wrote:

>>> Yes, see
>>>
>>> ?jpeg
>>> ?bitmap
>>>
>>> and as you didn't tell us your OS we don't know if these are available 
>>> to you.
>>>
>>> jpeg(file="test.jpg")
>>> boxplot(sample(100))
>>> dev.off()
>>>
>>> may well work.
>>>
>>> 'An Introduction to R' explains about graphics devices, including these.
>>>
>>>
>>> On Wed, 16 Aug 2006, Lothar Botelho-Machado wrote:
>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> R Help Mailing List,
>>>>
>>>>
>>>> I'd like to generate a plot that I could display and/or store it as e.g.
>>>> jpeg. But unfortunately always a plotting window opens. Is it 
>>>> possible to prevent that?
>>>>
>>>> I tried the following:
>>>> R> bp<-boxplot( sample(100), plot=FALSE)
>>>>
>>>> This works somehow, but it only stores data (as discribed in the 
>>>> help) in bp and it is not possible afaik to display bp later on or 
>>>> store them as a jpeg.
>>>>
>>>> The next:
>>>> R> p<-plot(sample(100), sample(100), plot=FALSE)
>>>> ..and also a variant using jpeg() didn't work at all.
>>>>
>>>> Is there a way to generally store the plots as object, without 
>>>> displaying them, or perhaps directly saving them to disc as jpeg?
>>>>
>>>> A "Yes" or "No" or any further help/links are appreciated!!!
>>>

>
>
>
> Thank you for the explanation and your patience in answering me this
> obviously very simple question!!
>
> Originally I tried to store plots directly in a list. So writing them
> directly to disc was just a good alternative. I knew that that jpeg()
> provides functionality for that, but didn't use it correctly.
>
> Hence, is it also possible to store a plot in a list, somehow?
>
> Kind regards,
> Lothar


R-help@stat.math.ethz.ch mailing list
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.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE5HU1HRf7N9c+X7sRAguEAJ4855nuonJaB9VXHkGOr/SZhqow8wCfXcuB o8oqpYoJ7MXgnVtnuGAE5Yk=
=ZWgN
-----END PGP SIGNATURE-----



R-help@stat.math.ethz.ch mailing list
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. Received on Fri Aug 18 00:03:23 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 18 Aug 2006 - 02:22:13 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.