Hi, Eric Firing wrote: >> from pylab import * >> X, Y = meshgrid(linspace(-3,3,11),linspace(-3,3,11)) >> Z = randn(*X.shape) >> lev = linspace(Z.min(),Z.max(),11)[1:-1] >> contourf(X,Y,Z, lev, extend='both') >> contour(X,Y,Z, lev, colors='k') >> show() > > Now, you may be wondering why we can't simply use the boundary of the > filled regions for the lines as well, to guarantee they are the same. > The reason is that filled contour boundaries include cuts connecting > inner and outer contours, and also inner boundaries (edges of masked > regions--except when affected by a bug) and the outer boundaries of the > domain). It might be possible to simply exclude those line segments > from the line contours, but it is not clear to me that the effort would > be well-spent.
OK, thanks for the explanations. I was using this dual approach contourf+contour to emphasize the contours from contourf. So is there a direct way to set the linewidth and linecolor (and linestyle?) of contours from contourf? (I suspect not, according to contourf documentation: contourf differs from the Matlab (TM) version in that it does not draw the polygon edges, because the contouring engine yields simply connected regions with branch cuts. To draw the edges, add line contours with calls to contour. ) > I think that the differences illustrated in your example will occur > almost entirely in pathologically ambiguous cases, but it is also Not necessarily pathological cases, just noisy data :-/ (I agree my randn-based example was a bit extreme!) Cheers. -- / \ , , _._ _ |oo| _ / \__/ \ _|||| ((/ () \)) / \ Yannick COPIN (o:>* Doctus cum libro |||||/| ( ==== ) |oo| Institut de physique nucleaire de Lyon \____/ _`\ /'_ / \ (IN2P3 - France) / /.-' /\<>/\ `\.( () )_._ Tel: (33/0) 472 431 968 | ` / \/ \ /`'--'////) http://snovae.in2p3.fr/ycopin/ \__,-'`| |. |\/ |/\/\|"\"` AIM: YcCopin ICQ: 236931013 jgs | |. | \___/\___/ | |. | | | ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users