[Rd] copy or save to metafile from graphics device shrinks plots (PR#1507)

drew.tyre@csiro.au drew.tyre@csiro.au
Fri, 3 May 2002 04:26:08 +0200 (MET DST)


Full_Name: Drew Tyre
Version: 1.4.0
OS: Win 2000
Submission from: (NULL) (140.253.74.225)


When creating a rather complex plot, the resulting figures 'shrink' when either
copied to the clipboard or saved as a metafile using the GUI menu. Also saving
as postscript or pdf causes the same problem, as does printing the figure
directly from the graphics window. Only the figure areas shrink, the contents
appear to have the same size, leading to clipping around the edges. Saving as
PNG format works, as does drawing directly to a win.metafile() device. I haven't
tried bitmap format.

The code is below; Aus() is an extension of oz() written by Nick Ellis - but
doesn't seem to be related to the problem (ie. replacing that call with a simple
plot() still creates the problem). I've tried to reproduce it with simpler plots
for some hours to no avail. Bug 1242 seems like the only related one, but I'm
not using lattice.grid. Given that there is a straightforward workaround
(suggested by Nick Ellis) by writing directly to a metafile device it seems like
a low priority. I'm happy to provide the data if anyone wants to look at it in
detail. 
         _              
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              

[1] ".GlobalEnv"        "sulphuric.accepta" "package:MASS"     
[4] "package:ctest"     "Autoloads"         "package:base"    


#source("C:/Program Files/R/rw1040/library/Aus/source.q")
#win.metafile("mapfigure.emf")
par(mfrow=c(2,2),mar=c(5.1,4.1,0.1,0.1))
Aus()
hermit.hill <- list(x=136.8314,y=-30.02850)
points(hermit.hill,pch="*",cex=2)
mtext("A",side=2,cex=2,las=2,at=par("yaxp")[2])

attach(sulphuric.accepta)
plot(easting,northing,type="n",bty="n",
axes=FALSE,xlab="",ylab="")
filled <- occupied == 1
points(easting[filled],northing[filled],
pch=19,cex=log10(area[filled]))
points(easting[!filled],northing[!filled],
pch=21,cex=log10(area[!filled]))
detach(2)

plot.limits <- par(c("xaxp","yaxp"))
segments(plot.limits$xaxp[1],plot.limits$yaxp[2],
plot.limits$xaxp[1]+100,plot.limits$yaxp[2],lwd=3)
text(x=plot.limits$xaxp[1]+50,y=plot.limits$yaxp[2]-5,adj=c(0.5,1),labels=c("100
m"))

mtext("B",side=2,cex=2,las=2,at=par("yaxp")[2])

attach(sulphuric.isopods)
plot(easting,northing,type="n",bty="n",
axes=FALSE,xlab="",ylab="")
filled <- occupied == 1
points(easting[filled],northing[filled],
pch=19,cex=log10(area[filled]))
points(easting[!filled],northing[!filled],
pch=21,cex=log10(area[!filled]))
detach(2)

plot.limits <- par(c("xaxp","yaxp"))
segments(plot.limits$xaxp[1],plot.limits$yaxp[2],
plot.limits$xaxp[1]+100,plot.limits$yaxp[2],lwd=3)
text(x=plot.limits$xaxp[1]+50,y=plot.limits$yaxp[2]-5,adj=c(0.5,1),labels=c("100
m"))

mtext("C",side=2,cex=2,las=2,at=par("yaxp")[2])

attach(bopeechee.zeidleri)
plot(easting,northing,type="n",bty="n",
axes=FALSE,xlab="",ylab="")
filled <- occupied == 1
points(easting[filled],northing[filled],
pch=19,cex=log10(area[filled]))
points(easting[!filled],northing[!filled],
pch=21,cex=log10(area[!filled]))
detach(2)

plot.limits <- par(c("xaxp","yaxp"))
segments(plot.limits$xaxp[1],plot.limits$yaxp[2],
plot.limits$xaxp[1]+100,plot.limits$yaxp[2],lwd=3)
text(x=plot.limits$xaxp[1]+50,y=plot.limits$yaxp[2]-5,adj=c(0.5,1),labels=c("100
m"))

mtext("D",side=2,cex=2,las=2,at=par("yaxp")[2])
#dev.off()

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._