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 plot(xy[:,0],xy[:,1],'w'

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 Line

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, [0

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. S