valenta@euromise.cz
2004-May-26 10:35 UTC
[Rd] Saving Trellis Graphics in R 1.9.0. (PR#6915)
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
I have occasionally noticed this too in 1.9.0 but have been unable to come up with a simple reproducible example. I'll try to look into it further to see if I can. -roger valenta@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@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel >
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@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@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
I believe the problem that Zednek described is specific to Windows, and had been reported and fixed in the current R-patched. Cheers, Andy> From: Roger D. Peng > > I have occasionally noticed this too in 1.9.0 but have been unable to > come up with a simple reproducible example. I'll try to look into it > further to see if I can. > > -roger > > valenta@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
Unfortunately, my example produces an empty Postscript file on Linux, even with a recent patched version. To be specific, the file is not actually empty, but appears blank when viewed in a previewer. I don't think I know enough about Postscript to report anything useful. -roger Liaw, Andy wrote:> I believe the problem that Zednek described is specific to Windows, and had > been reported and fixed in the current R-patched. > > Cheers, > Andy > > >>From: Roger D. Peng >> >>I have occasionally noticed this too in 1.9.0 but have been unable to >>come up with a simple reproducible example. I'll try to look into it >>further to see if I can. >> >>-roger >> >>valenta@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 > > > > ------------------------------------------------------------------------------ > Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. > ------------------------------------------------------------------------------ >
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@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@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@stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>>
>
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
On Wed, 26 May 2004 10:34:58 +0200 (CEST), valenta@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.This should be fixed in today's build of 1.9.1 alpha. Duncan Murdoch