Skip to content

Bug Report

5 messages · Richard Martin, Simon Urbanek, Daschbach, John L +1 more

#
Good Morning,

I believe I have found a bug within R.app. It's a problem with
quartz.save() which _seems_ to manifest itself when using par(mfcol)
to create multi-window graphs (and hence affects topology plots etc).

I have created a script which will repeat the bug _most_ of the time.

for(i in 1:5) {

quartz()
par(mfcol=c(2,2))
plot(1:10, type="b")
plot(1:10, type="b")
plot(1:10, type="b")
plot(1:10, type="b")
quartz.save(paste(i, ".pdf"), type="pdf")

}

EXPECTED OUTCOME: 5 files, named 1.pdf to 5.pdf, containing 4 graphs.
Each pdf should be identical.
ACTUAL OUTCOME: The pdf files are most often not equal. Sometimes
individual plots are left off the graphs (such that 1.pdf contains
only 2 or 3 plots, for example). More seriously, in some instances
console text is superimposed in a translated manner over the graphs
themselves. This can be seen in the attached pdf.

R version information follows:
$platform
[1] "i386-apple-darwin8.10.1"

$arch
[1] "i386"

$os
[1] "darwin8.10.1"

$system
[1] "i386, darwin8.10.1"

$status
[1] ""

$major
[1] "2"

$minor
[1] "6.2"

$year
[1] "2008"

$month
[1] "02"

$day
[1] "08"

$`svn rev`
[1] "44383"

$language
[1] "R"

$version.string
[1] "R version 2.6.2 (2008-02-08)"

R.app version information:
R 2.6.2 GUI 1.23 (4932) (4932)

Mac Information:
Version 10.5.2, build 9C31

If you have any idea how to work around this bug, I'd be most
greatful. If you need any more information or I can help in any way,
please email.

Kind Regards,

Richard Martin
Research Officer,
University of Essex,
Colchester,
Essex,
CO4 3SQ
#
In addition to the previous message, this script has just produced a
script which is upside down and back-to-front. Please find it
attached.

Regards,

Richard
On 13/02/2008, Richard Martin <radiosity at gmail.com> wrote:

  
    
#
Richard,

thanks for the report. The issue is known and the only (known) cure  
lies in R-devel's new Quartz.
It seems to be triggered by concurrency - e.g. on my machine your  
example produces five equal and correct PDF plots without problems -  
hence it occurs more often on slower machines. You may find several  
post about this bug on this mailing list and some suggestions on how  
to deal with it (adding delays before saving, preventing output and  
probably in your case not starting new devices each time).

Cheers,
Simon
On Feb 13, 2008, at 7:40 AM, Richard Martin wrote:

            
2 days later
#
Richard,
    This problem has been around for a while.  Based on an earlier reply
from Simon on this I find the following has always worked.

quartz.save('tmp.pdf',type='pdf')
Sys.sleep(4)
quartz.save('fig4.pdf',type='pdf')

    I recall that plotting twice rather than just the delay helps, but I
don't have notes on that.

    As far as machine speed is concerned I don't think it is necessarily due
to slow machines.  I had the problem on a slow box (G4 2 procs) and also on
my new box (PowerMac 2.6 GHz, 4 cores, with only idle and system programs
running other than R).

    The Quartz output is really nice looking, but many of the journals we
publish in want eps or tiff for final figures.  Also, if your co-authors use
Word and not LaTeX then the pdf figures in the manuscript don't look so
great either.  The ghostscript conversion usually works, but the quality is
lower than the original pdf.  We have found converting to a high resolution
tiff (very large files) is the most reliable way to get figures in journals
without problems.

-John
On 2/13/08 5:53 AM, "Simon Urbanek" <simon.urbanek at r-project.org> wrote:

            
#
Fortunately, this problem goes away in R-devel. You can also output
directly to a file (or the clipboard) as a pixel-identical TIFF (or
other supported format, including PDF (but not EPS, you can output
Photoshop though...)

On Fri, Feb 15, 2008 at 3:03 PM, Daschbach, John L
<John.Daschbach at pnl.gov> wrote: