Skip to content

contourLines() starts a plot device

2 messages · Pierre Kleiber, Barry Rowlingson

#
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?

 > version

platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status   Patched
major    2
minor    1.0
year     2005
month    04
day      20
language R


Cheers, Pierre
#
Pierre Kleiber wrote:
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.

  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