interpolation methods used by contourf

Hello users and developers of matplot,
I would like to ask what kind of interpoaltion method is used by
pylab.countourf()?

I suppose that it uses linear interpolation to derive the areas between the contour lines.

Is that true?

Kind regards,
Timmie

Tim Michelsen wrote:

Hello users and developers of matplot,
I would like to ask what kind of interpoaltion method is used by
pylab.countourf()?

I suppose that it uses linear interpolation to derive the areas between the contour lines.

Is that true?

Kind regards,
Timmie

Timmie,

I am not sure exactly what you are asking. General contouring routines, such as the one in mpl, work by subdividing the domain into a set of contiguous polygons, calculating the points at which contours cross boundaries, and then connecting these points, usually with straight lines. Routines differ in the methods used to subdivide the domain and in the methods used to connect the points, since this can be ambiguous. The cntr.c code in mpl subdivides the domain into the rectangles given by the quadrilateral grid on which the data are provided. In contrast, some other routines divide each such rectangle into 4 triangles by interpolating a point in the middle.

If you want to contour data that are not on a regular grid, or that are on a regular but coarse grid, or that are too noisy to be contoured nicely (assuming the noise has a small scale relative to the scale of the signal), then you need to use a gridding routine of your choice before contouring. It is the job of the gridding routine to do any necessary interpolation and/or smoothing.

Eric