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 :)


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.

I hope that clarifies everything for you.

Ben Root