[Rd] Saving Trellis Graphics in R 1.9.0. (PR#6915)
rpeng at jhsph.edu
rpeng at jhsph.edu
Thu Jun 3 15:06:07 CEST 2004
An even simpler example that doesn't work for me (on Linux) is:
library(lattice)
xyplot(0 ~ 0)
dev.copy2eps(file = "asdf.ps")
The file `asdf.ps' is reproduced at the bottom. It appears blank when
viewed in gv. What does work for me is to do
trellis.device(dev = postscript, file = "asdf.ps", ...etc...)
xyplot(0 ~ 0)
dev.off()
This problem persists in recent R-devel with lattice 0.9-12.
> version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status Under development (unstable)
major 2
minor 0.0
year 2004
month 06
day 03
language R
-roger
%!PS-Adobe-3.0 EPSF-3.0
%%DocumentNeededResources: font Helvetica
%%+ font Helvetica-Bold
%%+ font Helvetica-Oblique
%%+ font Helvetica-BoldOblique
%%+ font Symbol
%%Title: R Graphics Output
%%Creator: R Software
%%Pages: (atend)
%%BoundingBox: 0 0 503 503
%%EndComments
%%BeginProlog
/bp { gs gs } def
% begin .ps.prolog
/gs { gsave } def
/gr { grestore } def
/ep { showpage gr gr } def
/m { moveto } def
/l { rlineto } def
/np { newpath } def
/cp { closepath } def
/f { fill } def
/o { stroke } def
/c { newpath 0 360 arc } def
/r { 4 2 roll moveto 1 copy 3 -1 roll exch 0 exch rlineto 0 rlineto
-1 mul 0 e
xch rlineto closepath } def
/p1 { stroke } def
/p2 { gsave bg setrgbcolor fill grestore newpath } def
/p3 { gsave bg setrgbcolor fill grestore stroke } def
/t { 6 -2 roll moveto gsave rotate
ps mul neg 0 2 1 roll rmoveto
1 index stringwidth pop
mul neg 0 rmoveto show grestore } def
/cl { grestore gsave newpath 3 index 3 index moveto 1 index
4 -1 roll lineto exch 1 index lineto lineto
closepath clip newpath } def
/rgb { setrgbcolor } def
/s { scalefont setfont } def
/R { /Font1 findfont } def
/B { /Font2 findfont } def
/I { /Font3 findfont } def
/BI { /Font4 findfont } def
/S { /Font5 findfont } def
1 setlinecap 1 setlinejoin
% end .ps.prolog
%%IncludeResource: font Helvetica
...skipping...
currentdict
end
/Font3 exch definefont pop
%%IncludeResource: font Helvetica-BoldOblique
/Helvetica-BoldOblique findfont
dup length dict begin
{1 index /FID ne {def} {pop pop} ifelse} forall
/Encoding ISOLatin1Encoding def
currentdict
end
/Font4 exch definefont pop
%%IncludeResource: font Symbol
/Symbol findfont
dup length dict begin
{1 index /FID ne {def} {pop pop} ifelse} forall
currentdict
end
/Font5 exch definefont pop
%%EndProlog
ep
%%Trailer
%%Pages: 0
%%EOF
rpeng at jhsph.edu wrote:
> Okay, here's one example that might reproduce this behavior. At least
> it doesn't work for me at the moment:
>
> library(lattice)
> trellis.device(dev = x11)
> set.seed(1); x <- rnorm(100); y <- rnorm(100)
> xyplot(y ~ x, panel = function(...) {
> panel.xyplot(...)
> ltext(0,0,labels = expression(paste("P(", beta[2] > 0, ")") == .65),
> cex = .6) })
> dev.copy2eps(file = "asdf.eps")
>
> Note that, when I run it on my computer, I do get the following
> warning after the call to xyplot():
>
> Warning message:
> X11 used font size 8 when 7 was requested
>
> So I have been warned, but I didn't think this would produce an empty
> plot. One problem, if I remember correctly, is that sometimes it
> works and sometimes it doesn't which I think is why I didn't bother
> with it before.
>
> -roger
>
> > version
> _
> platform i686-pc-linux-gnu
> arch i686
> os linux-gnu
> system i686, linux-gnu
> status alpha
> major 1
> minor 9.1
> year 2004
> month 05
> day 24
> language R
> >
>
> valenta at euromise.cz wrote:
>
>>Full_Name: Zdenek Valenta
>>Version: 1.9.0.
>>OS: Windows XP
>>Submission from: (NULL) (147.231.7.250)
>>
>>
>>I could not copy/save (Trelis) graphics using R version 1.9.0. The graphics
>>displayed normally, but copying/saving it only produced an empty file.
>>Everything works o.k. with R rel. 1.8.1.
>>
>>Best regards,
>>
>>Zdenek Valenta
>>
>>______________________________________________
>>R-devel at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>>
>
>
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list