On Tue, Feb 28, 2012 at 9:10 AM, Benjamin Root <ben.r...@ou.edu> wrote: > On Tuesday, February 28, 2012, Andreas H. wrote: >> >> Good morning, >> >> I'm creating the attached plot using pcolormesh(). What I would like to >> do now is draw contour lines at +/- 2.5%, which follow the grid edges. >> >> The problem is that when I use contour(), the lines drawn do not follow >> the grid edges but seem to be interpolated somehow. >> >> Do you have an idea how to draw the contour lines following the grid >> edges? >> >> Your insight is very much appreciated :) >> >> Cheers, >> Andreas. > > > This is because of a subtle difference in how pcolor-like functions and > contour-like functions work. I always forget which is which, but one > assumes that the z value lies on the vertices of the grid while the other > assumes that it lies in the middle of each grid point. This is why you see > them slightly offset from each other.
By definitition, with pcolormesh you're giving it the edges of the grid cells. In fact, for an NxN grid of data, you should have N+1xN+1 grids of x,y values. Contour is given the actual grid and values. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users