[Rd] unexpected postscript output with par(mfg)
Roger D. Peng
rpeng at jhsph.edu
Mon Feb 23 17:19:01 MET 2004
[I posted this earlier but am not sure if it ever made it to the list.
It appears to be in the archives, but I never received a copy sent
back to me.]
Hi, a colleague of mine encountered some unexpected behavior regarding
the postscript output from R. It's difficult for me to tell whether
or not this is an R problem or a ghostview/gv/interpreter problem.
Just to note, I think it's exactly the same situation reported here:
http://finzi.psych.upenn.edu/R/Rhelp02/archive/25436.html
The following code produces a working plot (no problems, as far as I
can see):
par(mfrow = c(2,2))
plot.new()
plot(1:10, 1:10, xlab = "", ylab = "")
plot(1:10, 1:10, xlab = "", ylab = "")
plot(1:10, 1:10, xlab = "", ylab = "")
dev.copy2eps(file = "plot1.eps")
However, the following code, which appears on the screen to be
identical to the above plot, generates an EPS file which ghostview/gv
displays as blank.
par(mfrow = c(2,2), mfg = c(1,2))
plot(1:10, 1:10, xlab = "", ylab = "")
plot(1:10, 1:10, xlab = "", ylab = "")
plot(1:10, 1:10, xlab = "", ylab = "")
dev.copy2eps(file = "plot2.eps")
If I use postcript() directly instead of dev.copy2eps(), plot1 is
again fine, and plot2 appears fine when viewed in gv. However, when
plot2 is included into a LaTeX file (via \includegraphics), it is
upside-down and backwards and resized.
Has anyone encountered such behavior before? When I run a diff on
plot1.eps and plot2.eps (generated by dev.copy2eps) it looks like
there is an entire chunk of code in plot1.eps that doesn't exist in
plot2.eps.
The problem was originally identified on Windows but it happens on
Linux too.
Any suggestions would be greatly appreciated.
-roger
More information about the R-devel
mailing list