Re: [R] contourLines() starts a plot device

From: Barry Rowlingson <B.Rowlingson_at_lancaster.ac.uk>
Date: Tue 24 May 2005 - 19:46:00 EST

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.

  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@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 Received on Tue May 24 19:51:27 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:01 EST