From maechler at stat.math.ethz.ch  Fri Feb 10 18:18:18 2006
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Fri, 10 Feb 2006 18:18:18 +0100
Subject: [Rd] invalid graphics state using dev.print (fwd)
In-Reply-To: <Pine.OSF.4.58.0602081515590.512812@wotan.mdacc.tmc.edu>
References: <Pine.OSF.4.58.0602081515590.512812@wotan.mdacc.tmc.edu>
Message-ID: <17388.51930.273876.336070@stat.math.ethz.ch>

>>>>> "Paul" == Paul Roebuck <roebuck at mdanderson.org>
>>>>>     on Wed, 8 Feb 2006 15:33:11 -0600 (CST) writes:

    Paul> On Mon, 6 Feb 2006 18:12, Simon Urbanek wrote:
    >> On Feb 6, 2006, at 5:24 PM, Paul Roebuck wrote:
    >> 
    >>> Tried on R-Sig-Mac with no responses, but I need some kind
    >>> of answer.
    >>> [...]
    >>> Does the following work on your system?
    >> 
    >> Interesting, no, it doesn't either. For png and pdf I use
    >> Quartz + quartz.save (it produces much nicer results) so
    >> I didn't really notice, but you're right. First I thought
    >> those graphics state issues are specific to the Quartz
    >> device, but you have proven that it's not. It's in fact
    >> not even Mac-specific - I have just reproduced it on a
    >> Linux box - that's why I'm moving this to R-devel.

    Paul> It's been several workdays now with no responses. Could
    Paul> someone try the last three lines of code and see if they
    Paul> get the following error message?

    >> x11()
    >> plot(rnorm(10))
    >> dev.print(png)

    Paul> Error in dev.copy(device = function (filename = "Rplot%03d.png", width =
    Paul> 480,  :
    Paul> invalid graphics state

    >> traceback()
    Paul> 6: dev.copy(device = function (filename = "Rplot%03d.png", width = 480,
    Paul> height = 480, pointsize = 12, gamma = 1, colortype =
    Paul> getOption("X11colortype"),
    Paul> maxcubesize = 256, bg = "white", fonts = getOption("X11fonts"),
    Paul> res = NA)
    Paul> .Internal(X11(paste("png::", filename, sep = ""), width, height,
    Paul> pointsize, gamma, colortype, maxcubesize, bg, bg, fonts,
    Paul> res)), width = 6.98715785526809, height = 6.99452568428947)
    Paul> 5: eval(expr, envir, enclos)
    Paul> 4: eval(expr, p)
    Paul> 3: eval.parent(oc)
    Paul> 2: dev.off(eval.parent(oc))
    Paul> 1: dev.print(png)

    Paul> I noticed it on OS X, and Simon on Linux. 

Yes, I can confim getting the same.
Just on Linux though (as Simon)

I'd say this should make a ``nice little''  bug.report() 

Interestingly, replacing

    dev.print(png)

by  dev.copy(png) ; dev.off()  

which is about equivalent,  *does* work and so is a workaround
to your problem.

Regards,
Martin

    Paul> Other platforms?  WFM?

    Paul> TIA

    >> version
    Paul> _
    Paul> platform powerpc-apple-darwin7.9.0
    Paul> arch     powerpc
    Paul> os       darwin7.9.0
    Paul> system   powerpc, darwin7.9.0
    Paul> status   Patched
    Paul> major    2
    Paul> minor    2.1
    Paul> year     2006
    Paul> month    02
    Paul> day      01
    Paul> svn rev  37245
    Paul> language R

    Paul> ----------------------------------------------------------
    Paul> SIGSIG -- signature too long (core dumped)



[Rd] invalid graphics state using dev.print (fwd)
Martin Maechler