Thanks to Benjamin Root and Jae-Joon Lee for their responses.
The solution that I had come up with in the mean time is similar to
Jae-Joon's suggestion. I did:
c = contour(z,level,colors='k')
xy = c.collections[0].get_paths()[0].vertices # produces (N,2) array of points
plot(xy[:,0],xy[:,1],'w'
contour creates list of LineCollection objects (per each level I
suppose) which is stored in "collections" attribute. For example,
cntr = contour(A, levels)
then
cntr.collections[i] is a LineCollection objects that is associated
with levels[i].
And you can change colors of each line in the Line
Actually, I just re-read your original message and noticed that you were
specifying your levels (I believe). The double set of contours depends on
what your values are. If you want to make absolutely sure that there aren't
extra lines, you could contour a boolean array:
contour(x, y, z > 4.5, [0
Jon,
One thing you can do is to manually specify the levels to contour for in the
contour call, or just specify the number of contours (and contour() will
figure out the levels for you). The fourth argument to contour() allows you
to give a sequence of values (or an integer) for the isopleths. S
To all:
I'm making a plot with an image and a contour on it. I use only one
level in the call to contour, but it results in two distinct contours,
an inner closed one and an outer open one. I want to plot only the
outer piece. How might I go about that? I've been looking at the
properties of t