Daniel Fulger, on 2011-01-27 18:16, wrote:
contourset = pyplot.contour(..)
calculates the contourset but also grabs whatever figure is currently
active *somewhere* in the entire code
and whichever scope it was created. The contours are plotted into it.
While I could possibly live with that, I would really like to
suppress any plotting and grabbig of focus. Only the contourset
should be calculated.
I can't find anything that describes this. Everybody wants the plot,
I would like to avoid hte workaround to ask for the currently active
figure (if!! there is one at all), store the number, and later return
focus. Is there no switch parameter (in pyplot or for contour at
least) that turns plotting off?
I'm not sure if this gets at what you're asking for, but if
you just want the contours plotted on a figure other than the
currently active one, grab a handle to some other axes and call
contour from the axes itself (the parameters are the same).
Here's what I mean:
f,ax =plt.subplots(1,1) #grab handles to figure and axes
# or, if you're using an older version of matplotlib, do:
f2,ax2 =plt.subplots(1,1) # "f" no longer active figure
contourset = ax.contour(...) # draw to the old figure "f"
You can read more about the difference between using pyplot and
using the object-oriented api here:
On the other hand, if you just want the contour to not show up,
you can pass it alpha=0.0 to make it completely transparent and
invisible (but it's still there)
contourset = pyplot.contour(.., alpha=0.0)
# later call contourset.set_alpha(1.0) to make visible again
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7