[R] png problem

Paul Murrell p.murrell at auckland.ac.nz
Thu Sep 23 00:19:22 CEST 2004


Hi


Clément Calenge wrote:
> Hello,
> 
> Thanks for the fast reply.
> 
> Paul Murrell wrote:
> 
>> Hi
>>
>>
>> Clément Calenge wrote:
>>
>>> Dear R-users,
>>> I have a small problem with the function png(), when used with the
>>> argument colortype="pseudo.cube".
>>>  > png("toto.png", colortype="pseudo.cube")
>>>  > image(matrix(rnorm(10000), 100, 100))
>>>  > dev.off()
>>> R is blocked at the last command (R does not
>>> print any prompt after the last command). Nothing is
>>> written in the file (Gimp indicates that the file is corrupted).
>>
>>
>>
>> Did you wait long enough?  This example took a little while to 
>> complete for me (may need someone more familiar with the code to tell 
>> us why it is so slow).
> 
> 
> You're right, it took 45 minutes for me.
> However, since I need to use this code to build a Sweave vignette,
> I cannot use it too often (I have about thirty files to create, this
> would take about 20 hours to build the vignette !).
> I also need the colortype argument (some graphics cards
> do not allow the compilation of the vignette without).
> Does anyone knows how to speed up the process ?


Wow!  It didn't take that long for me (maybe a minute or two).

A possibly useful observation in case anyone else takes a look at this 
before me:  when I debugged it and ctrl-C'ed to interrupt every now and 
then, the interrupt always happened inside a call to XQueryColor (in 
bitgp(), in devX11.c), so that may be the slow part.

Paul


>> Paul
>>
>>
>>> However,
>>>  > png("toto.png")
>>>  > image(matrix(rnorm(10000), 100, 100))
>>>  > dev.off()
>>> works fine.
>>> I tried:
>>>  > options(X11colortype = "pseudo.cube")
>>>  > png("toto.png")
>>>  > image(matrix(rnorm(10000), 100, 100))
>>>  > dev.off()
>>> But, here again, R is blocked. I tried to replace dev.off() by
>>> graphics.off(), but this does not resolve the problem.
>>> The problem does not occurs when the function X11() is used
>>> instead of the function png().
>>> I searched through the mail archive, the FAQ, on google,
>>> but I did not found any solution to this problem.
>>> On the help page on the function png(),
>>> it is indicated that "The colour handling will be that of the 'X11'
>>> device in use".
>>> I never used these functions before, but maybe png()
>>> is not suitable with colortype="pseudo.cube" ?
>>> Can you tell me where I have missed something ?
>>> Thanks in Advance,
>>> Clément Calenge.
>>>  >version
>>>           _
>>> platform sparc-sun-solaris2.9
>>> arch     sparc
>>> os       solaris2.9
>>> system   sparc, solaris2.9
>>> status
>>> major    1
>>> minor    9.1
>>> year     2004
>>> month    06
>>> day      21
>>> language R
>>>         [[alternative HTML version deleted]]
>>> ______________________________________________
>>> R-help at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide! 
>>> http://www.R-project.org/posting-guide.html
>>
>>
>>
>> -- 
>> Dr Paul Murrell
>> Department of Statistics
>> The University of Auckland
>> Private Bag 92019
>> Auckland
>> New Zealand
>> 64 9 3737599 x85392
>> paul at stat.auckland.ac.nz
>> http://www.stat.auckland.ac.nz/~paul/
>>
> 
> ======================================
> UMR CNRS 5558 - Equipe "Ecologie Statistique"
> Laboratoire de Biométrie et Biologie Evolutive
> Université Claude Bernard Lyon 1
> 43, Boulevard du 11 novembre 1918
> 69622 Villeurbanne Cedex
> FRANCE
> tel. (+33) 04.72.43.27.57
> fax. (+33) 04.72.43.13.88
> 


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list