From dmb at mrc-dunn.cam.ac.uk  Thu Apr 28 00:48:05 2005
From: dmb at mrc-dunn.cam.ac.uk (Dan Bolser)
Date: Thu Apr 28 00:48:08 2005
Subject: [Rd] Re: [Filtered!] Re: [R] postscript (eps) / latex /
 par(mfg=...) / problem!
In-Reply-To: <1114556859.8390.108.camel@horizons.localdomain>
Message-ID: <Pine.LNX.4.21.0504272347300.9191-100000@mail.mrc-dunn.cam.ac.uk>

On Tue, 26 Apr 2005, Marc Schwartz wrote:

>Warning: This message has had one or more attachments removed
>Warning: (x.mfg.eps).
>Warning: Please read the "FilterNotice.txt" attachment(s) for more information.
>
>[MOVED TO R-DEVEL]
>
>On Tue, 2005-04-26 at 18:05 +0100, Dan Bolser wrote:
>> Should I post this to 'bugs'?
>
>Dan,
>
>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
>("mfg").
>
>
>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")
>
>dev.off()
>
>
>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
>("mfg").
>
>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:
>
>\documentclass{report}
>\usepackage{graphicx}
>\begin{document}
>\begin{figure}
>  \centering
>  \includegraphics[width=\textwidth]{x.mfg.eps}
>  \caption[X]{Hello!}
>  \label{xFig}
>\end{figure}
>\end{document}
>
>
>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:
>
>http://tolstoy.newcastle.edu.au/R/devel/04a/0344.html
>
>http://finzi.psych.upenn.edu/R/Rhelp02a/archive/25436.html
>
>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").

Yup! I created a bug so hopefully its safely logged (described) now?

Cheers,
Dan.

>
>HTH,
>
>Marc Schwartz
>
>


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