[R] lattice dotplot and graphic devices on Windows

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jan 29 12:33:25 CET 2002


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list