[R] contourLines() starts a plot device

Paul Murrell p.murrell at auckland.ac.nz
Tue Jun 21 04:08:07 CEST 2005


Hi


Barry Rowlingson wrote:
> Pierre Kleiber wrote:
> 
>> I want to use contourLines() to get contour line coordinate vectors, 
>> but I don't want to make a plot.  However contourLines() insists on
>> opening a graphics device.  Is there a way tell it not to do this?
> 
> 
> contourLines() calls .Internal(contourLines(...)), and that calls 
> do_contourlines in plot3d.c, and that gets the current graphics device, 
> hence activating one if there isn't one (I think), and passes it to 
> GEcontourLines... which then seems to do nothing with it at all.
> 
>  I just removed 'dd' from the call to GEcontourLines and the arg list to 
> GEcontourLines, fixed GraphicsEngine.h to match, recompiled, and now my 
> contourLines() function doesn't try to make a new graphics window. I 
> can't see GEcontourLines being called from anywhere else, but there may 
> be code that calls it, so possibly a better idea may be to pass a NULL 
> to it from GEcontourLines to keep the API the same.


Thanks for the diagnosis and suggested fix!
This change has now been made in the development version of R.

Paul


>  There are some comments scattered around the code about how 
> contourLines shouldnt really be a graphics function, so I'm guessing 
> there's some thought going into this already by the developers.
> 
>  Another possible quick fix for unix systems may be to start a 
> PostScript graphics device with file="/dev/null" so that the graphics 
> output disappears into thin air.
> 
> Baz
> 
> ______________________________________________
> 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/




More information about the R-help mailing list