Grathwohl,Dominik,LAUSANNE,NRC/BAS
2003-Jul-03 15:12 UTC
[R] Bug in plotting groupedData-objects
Dear Experts, May be the problem is still solved, however I tried to find the answer in the archives: I use:> R.version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 7.1 year 2003 month 06 day 16 language R # a small program to show you the problem: library(NLME) n <- 300 id <- gl(n, 3, 3*n) visit <- rep(c(1:3), n) y <- rnorm(3*n) weight <- data.frame(cbind(id, visit, y)) d <- groupedData(y ~ visit|id, data=weight, labels=list(visit="Week", y="DHA", id="ID"), units=list(visit="(weeks)", y="(%)"), order.groups=F) plot(d) # save by hand: 1.5 MB if(interactive()) { win.metafile(filename="c:/tmp/mist.emf") plot(d) dev.off() } # The file mist.emf is empty, however the plot command before works. if(interactive()) { win.metafile(filename="c:/tmp/mist2.emf") plot(visit,y) dev.off() } # changing object, the file mist2.emf is not empty: if(interactive()) { jpeg(filename="c:/tmp/mist.jpg", width=600, height=600, pointsize=12, quality=100, bg="white") plot(d) dev.off() } # changing the driver, mist.jpg is empty! # So the problem seems to be some interaction with groupedData objects and graphic drivers. # Any hind is appreciated # Regards, # Dominik Dominik Grathwohl Biostatistician Nestl? Research Center PO Box 44, CH-1000 Lausanne 26 Phone: + 41 21 785 8034 Fax: + 41 21 785 8556 e-mail: dominik.grathwohl at rdls.nestle.com
Aren't these lattice plots that you have not print()-ed? Auto-printing
does not work except at top-level, and if(interactive() { ... } is not
top-level.
Using print(plot(d)) works for me.
On Thu, 3 Jul 2003, Grathwohl,Dominik,LAUSANNE,NRC/BAS wrote:
> Dear Experts,
>
> May be the problem is still solved, however I tried to find the answer in
> the archives:
> I use:
> > R.version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 1
> minor 7.1
> year 2003
> month 06
> day 16
> language R
>
>
> # a small program to show you the problem:
>
> library(NLME)
It's nlme, not NLME
> n <- 300
>
> id <- gl(n, 3, 3*n)
>
> visit <- rep(c(1:3), n)
>
> y <- rnorm(3*n)
>
> weight <- data.frame(cbind(id, visit, y))
>
> d <- groupedData(y ~ visit|id, data=weight,
> labels=list(visit="Week", y="DHA", id="ID"),
> units=list(visit="(weeks)", y="(%)"), order.groups=F)
>
> plot(d) # save by hand: 1.5 MB
>
> if(interactive()) {
> win.metafile(filename="c:/tmp/mist.emf")
> plot(d)
> dev.off()
> }
>
> # The file mist.emf is empty, however the plot command before works.
>
>
> if(interactive()) {
> win.metafile(filename="c:/tmp/mist2.emf")
> plot(visit,y)
> dev.off()
> }
>
> # changing object, the file mist2.emf is not empty:
>
> if(interactive()) {
> jpeg(filename="c:/tmp/mist.jpg", width=600, height=600,
> pointsize=12, quality=100, bg="white")
> plot(d)
> dev.off()
> }
>
> # changing the driver, mist.jpg is empty!
> # So the problem seems to be some interaction with groupedData objects and
> graphic drivers.
> # Any hind is appreciated
>
> # Regards,
>
> # Dominik
>
> Dominik Grathwohl
> Biostatistician
> Nestl? Research Center
> PO Box 44, CH-1000 Lausanne 26
> Phone: + 41 21 785 8034
> Fax: + 41 21 785 8556
> e-mail: dominik.grathwohl at rdls.nestle.com
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>
--
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
Grathwohl,Dominik,LAUSANNE,NRC/BAS
2003-Jul-03 15:32 UTC
[R] Bug in plotting groupedData-objects
Thank you very much, problem solved! For me it's a bit strange, because I worked several years in this way and suddenly it did not work any more. What are the appropriate top-level commands? Kind regards, Dominik> -----Original Message----- > From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] > Sent: jeudi, 3. juillet 2003 17:26 > To: Grathwohl,Dominik,LAUSANNE,NRC/BAS > Cc: 'r-help at stat.math.ethz.ch' > Subject: Re: [R] Bug in plotting groupedData-objects > > > Aren't these lattice plots that you have not print()-ed? > Auto-printing > does not work except at top-level, and if(interactive() { ... > } is not > top-level. > > Using print(plot(d)) works for me. > > > On Thu, 3 Jul 2003, Grathwohl,Dominik,LAUSANNE,NRC/BAS wrote: > > > Dear Experts, > > > > May be the problem is still solved, however I tried to find > the answer in > > the archives: > > I use: > > > R.version > > _ > > platform i386-pc-mingw32 > > arch i386 > > os mingw32 > > system i386, mingw32 > > status > > major 1 > > minor 7.1 > > year 2003 > > month 06 > > day 16 > > language R > > > > > > # a small program to show you the problem: > > > > library(NLME) > > It's nlme, not NLME > > > n <- 300 > > > > id <- gl(n, 3, 3*n) > > > > visit <- rep(c(1:3), n) > > > > y <- rnorm(3*n) > > > > weight <- data.frame(cbind(id, visit, y)) > > > > d <- groupedData(y ~ visit|id, data=weight, > > labels=list(visit="Week", y="DHA", id="ID"), > > units=list(visit="(weeks)", y="(%)"), order.groups=F) > > > > plot(d) # save by hand: 1.5 MB > > > > if(interactive()) { > > win.metafile(filename="c:/tmp/mist.emf") > > plot(d) > > dev.off() > > } > > > > # The file mist.emf is empty, however the plot command before works. > > > > > > if(interactive()) { > > win.metafile(filename="c:/tmp/mist2.emf") > > plot(visit,y) > > dev.off() > > } > > > > # changing object, the file mist2.emf is not empty: > > > > if(interactive()) { > > jpeg(filename="c:/tmp/mist.jpg", width=600, height=600, > > pointsize=12, quality=100, bg="white") > > plot(d) > > dev.off() > > } > > > > # changing the driver, mist.jpg is empty! > > # So the problem seems to be some interaction with > groupedData objects and > > graphic drivers. > > # Any hind is appreciated > > > > # Regards, > > > > # Dominik > > > > Dominik Grathwohl > > Biostatistician > > Nestl? Research Center > > PO Box 44, CH-1000 Lausanne 26 > > Phone: + 41 21 785 8034 > > Fax: + 41 21 785 8556 > > e-mail: dominik.grathwohl at rdls.nestle.com > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > > > > -- > 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 >