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') c.collections[0].get_paths() returns a list of Path objects. These have the attribute vertices which contains the values used to draw the contour. Jae-Joon's method is a bit more straightforward than mine, though it's nice to know where those contour paths are stored. Jon On Tue, 2010-06-22 at 22:40 -0400, Jae-Joon Lee wrote: > 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 LineCollection object > with set_edgecolors method. > > So, assuming that there is two contour lines for the first level. > > cntr.collections[0].set_edgecolors(["none", "r"]) > > will change the color of the first contour to "none" (i.e., not drawn) > and the second one to red. > > But you need to figure out which one is the one you want. > > IHTH, > > -JJ > > > On Tue, Jun 22, 2010 at 2:46 PM, Jonathan Slavin > <jsla...@cfa.harvard.edu> wrote: > > 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 the ContourSet object returned by the call to contour but > > can't find anything useful yet. Is there an attribute of ContourSet > > objects that contains the (x,y) values for the contour? Is there some > > way to see that a ContourSet object has separate pieces? > > > > Any help would be appreciated. > > > > Thanks, > > Jon > > > > > > ------------------------------------------------------------------------------ > > ThinkGeek and WIRED's GeekDad team up for the Ultimate > > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > > lucky parental unit. See the prize list and enter to win: > > http://p.sf.net/sfu/thinkgeek-promo > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- ______________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jsla...@cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ______________________________________________________________ ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users