|
From: Ryan M. <rm...@gm...> - 2012-02-28 15:20:12
|
On Tue, Feb 28, 2012 at 9:10 AM, Benjamin Root <ben...@ou...> 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 |