Re: [Matplotlib-users] selecting part of a contour to plot

2010-06-23 Thread Jonathan Slavin
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

[Matplotlib-users] selecting part of a contour to plot

2010-06-22 Thread Jonathan Slavin
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

Re: [Matplotlib-users] selecting part of a contour to plot

2010-06-22 Thread Benjamin Root
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.

Re: [Matplotlib-users] selecting part of a contour to plot

2010-06-22 Thread Benjamin Root
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,

Re: [Matplotlib-users] selecting part of a contour to plot

2010-06-22 Thread Jae-Joon Lee
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