[Rd] Re: [R] postscript (eps) / latex / par(mfg=...) / problem!

Marc Schwartz MSchwartz at MedAnalytics.com
Wed Apr 27 01:07:39 CEST 2005


On Tue, 2005-04-26 at 18:05 +0100, Dan Bolser wrote:
> Should I post this to 'bugs'?


I suspect part of the problem here is that your code and example were
difficult to replicate and there may have been a focus on the page
rotation issue, which I think is a red herring here.

All below is done with Version 2.1.0 Patched (2005-04-20), which is more
recent of course and may reflect an existing problem when using par

mat <- matrix(c(1:14, 16, 20, 23, 24, 26, 28,
         886, 792, 136, 201, 16, 58, 6,
         21, 3, 9, 3, 9, 1, 4, 3, 1, 1,
         1, 1, 1), ncol = 2)

colnames(mat) <- c("CHAINS", "FREQUENCY")

# Use either the EPS or PDF creation here
# Naming the output file based upon the use or non-use
# of par("mfg")

# Comment the two par("mfg") lines below as appropriate

postscript("x.mfg.eps", width = 6, height = 6,
           horizontal = FALSE, onefile = FALSE,
           paper = "special")

# pdf("nomfg.pdf", width = 5, height = 6)
par(mfrow= c(2, 1))

par(mfg = c(1, 1))
par(mar = c(3, 4, 1, 2))
plot(mat, type = "b")

par(mfg = c(2, 1))
par(mar = c(4, 4, 0, 2))
plot(mat, type = "b", log = "y")


What I found, if correct, does not reflect rotation issues with the
graphic, but a problem when using par("mfg"), resulting in both EPS and
PDF files having a 0 page indication in the resultant file. I have
attached EPS and PDF files here named based upon using or not using par

I also used the following LaTeX code to create PS/PDF files as
appropriate with curious results. Modify the included graphic file name
as appropriate when using it:


When using latex and dvips with the x.mfg.eps file, the plot is in the
upper left hand corner of the page, very small. Substituting the
x.nomfg.eps file, the page looks fine.

When using pdflatex with the mfg.pdf file, get the following error:

Error: pdflatex (file mfg.pdf): pdf inclusion: required page does not
exist <0>

 ==> Fatal error occurred, the output PDF file is not finished!

Trying to open the mfg.pdf file, I get errors from multiple PDF viewers
indicating the lack of pages in the file.

Interestingly, when opening the EPS files in gv, it seems to happily
ignore the 0 page issue and displays the x.mfg.eps file without problem.

There are a few other posts in the archive that report problems that
were presumed to be the usual rotation issues that Ted refers to in his
reply post on r-help.

However, when reading them:



in both cases, par("mfg") is being used, which is common to Dan's
problem here.

So, unless I am missing something and without yet delving further into
graphic device specific source code, I suspect that there is a problem
when creating PS/EPS/PDF files in conjunction with par("mfg").


Marc Schwartz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mfg.pdf
Type: application/pdf
Size: 7620 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20050426/718503ea/mfg.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nomfg.pdf
Type: application/pdf
Size: 7852 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20050426/718503ea/nomfg.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.mfg.eps
Type: application/postscript
Size: 6463 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20050426/718503ea/x.mfg.eps
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.nomfg.eps
Type: application/postscript
Size: 6478 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20050426/718503ea/x.nomfg.eps

More information about the R-devel mailing list