I am using R1.4.0 on WindowsNT (the precompiled version from Brian Ripley's website) and the lattice package (version details are at the end of this message). After producing a lattice dotplot, I want to insert the graph into a MicrosoftWord document. With "ordinary" R-graphics, I have done this successfully by copying the graph as a metafile to the clipboard and pasting this into my word document. However, when trying to do the same with a lattice plot, I encountered some problems: # simple example:> library(lattice) > test <- data.frame(a = c("A","A","B","B"), x = 1:4, g rep(c("g1","g2"),2)) > trellis.device(width=3.35, height=3.35, color=F) > dotplot(a~x, groups=g, data=test, panel="panel.superpose" )# this is fine on screen, but when right-clicking on the picture and chosing "Copy as metafile", an error is generated: Error: A metafile can store only one figure. # However, "Copy as bitmap" works (but quality is poorer when pasting to WinWord). # What also works is chosing from the menu "File>Save As>Jpeg" (or Bmp). # As jpeg and bmp work, I try to print this to a file directly, but get an error:> dev.off() > trellis.device("jpeg", quality=100, width=3.35, height=3.35, color=F) > dotplot(a~x, groups=g, data=test, panel="panel.superpose" )Error in grid.newpage() : A jpeg file can store only one figure. # same with bmp:> trellis.device("bmp", width=3.35, height=3.35, color=F) > dotplot(a~x, groups=g, data=test, panel="panel.superpose" )Error in grid.newpage() : A bmp file can store only one figure.>So my three points here are: 1) Is there a way to copy and/or save the graph as a metafile? 2) If not, can someone give advice which graphic format else is the best to use here (it seems to me that bitmap is not)? 3) As saving (in jpeg, bmp) via the file menu works here, shoudn't these graphic devices work with "trellis.device" as well? --------------------------- version information:> version_ platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 4.0 year 2001 month 12 day 19 language R># from the package Description files: Package: lattice Version: 0.4-0 Date: 2002/01/10 Package: grid Version: 0.5 Date: 2000/11/07 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian Ripley
2002-Jan-29 11:33 UTC
[R] lattice dotplot and graphic devices on Windows
Update your version of grid. This is a known problem, reported here many times and fixed in grid 0.5-1. On Tue, 29 Jan 2002, RINNER Heinrich wrote:> I am using R1.4.0 on WindowsNT (the precompiled version from Brian Ripley's > website) and the lattice package (version details are at the end of this > message). > After producing a lattice dotplot, I want to insert the graph into a > MicrosoftWord document. With "ordinary" R-graphics, I have done this > successfully by copying the graph as a metafile to the clipboard and pasting > this into my word document. > > However, when trying to do the same with a lattice plot, I encountered some > problems: > > # simple example: > > library(lattice) > > test <- data.frame(a = c("A","A","B","B"), x = 1:4, g > rep(c("g1","g2"),2)) > > trellis.device(width=3.35, height=3.35, color=F) > > dotplot(a~x, groups=g, data=test, panel="panel.superpose" ) > # this is fine on screen, but when right-clicking on the picture and chosing > "Copy as metafile", an error is generated: > Error: A metafile can store only one figure. > > # However, "Copy as bitmap" works (but quality is poorer when pasting to > WinWord). > # What also works is chosing from the menu "File>Save As>Jpeg" (or Bmp). > > # As jpeg and bmp work, I try to print this to a file directly, but get an > error: > > dev.off() > > trellis.device("jpeg", quality=100, width=3.35, height=3.35, color=F) > > dotplot(a~x, groups=g, data=test, panel="panel.superpose" ) > Error in grid.newpage() : A jpeg file can store only one figure. > # same with bmp: > > trellis.device("bmp", width=3.35, height=3.35, color=F) > > dotplot(a~x, groups=g, data=test, panel="panel.superpose" ) > Error in grid.newpage() : A bmp file can store only one figure. > > > > So my three points here are: > 1) Is there a way to copy and/or save the graph as a metafile? > 2) If not, can someone give advice which graphic format else is the best to > use here (it seems to me that bitmap is not)? > 3) As saving (in jpeg, bmp) via the file menu works here, shoudn't these > graphic devices work with "trellis.device" as well? > > > --------------------------- > version information: > > > version > _ > platform i386-pc-mingw32 > arch x86 > os Win32 > system x86, Win32 > status > major 1 > minor 4.0 > year 2001 > month 12 > day 19 > language R > > > # from the package Description files: > Package: lattice > Version: 0.4-0 > Date: 2002/01/10 > Package: grid > Version: 0.5 > Date: 2000/11/07 > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian Ripley
2002-Jan-29 14:05 UTC
[R] lattice dotplot and graphic devices on Windows
On Tue, 29 Jan 2002, I wrote:> > Update your version of grid. This is a known problem, reported here many > > times and fixed in grid 0.5-1.Heinrich Ritter commented that this had not been announced. Since that may be a common misunderstanding, let me explain. It is not usual to announce patch releases (here -1) of packages. You would get tired of hearing about them: there have been at least 70 since 1.4.0 was announced on Dec 19. (Your maintainers do get a bit tired of the flood sometimes too.) What we do expect is that you run update.packages() fairly frequently, and certainly when you encounter a problem. -- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi> > > Update your version of grid. This is a known problem, reported heremany> > > times and fixed in grid 0.5-1. > > Heinrich Ritter commented that this had not been announced. Since that > may be a common misunderstanding, let me explain. It is not usual to > announce patch releases (here -1) of packages. You would get tired of > hearing about them: there have been at least 70 since 1.4.0 was announced > on Dec 19. (Your maintainers do get a bit tired of the flood sometimes > too.) What we do expect is that you run update.packages() fairly > frequently, and certainly when you encounter a problem.Since there were a few problems reported, here's a bit more information about the bug-fix version of grid, 0.5-1. The purpose of this version is to fix the following bugs: (i) grid (lattice) output could not be saved in metafile format (ii) non-grid output could not be saved in metafile format when grid (lattice) was loaded (iii) empty page at start of grid (lattice) postscript output (iv) empty page at start of non-grid postscript output when grid (lattice) was loaded (v) copying grid (lattice) output from x11 to postscript (dev.copy) produced blank pages in postscript The latest version of the lattice package (version 0.4-0) should work fine with this new version of grid. Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._