However, when I specify the same number of levels as suggested, contourf divides this example into three regions, with a diagonal 'stripe' instead of a clean boundary, so I guess I'm asking whether it's possible to trick contourf into generating a single boundary between the two regions such that it matches that found by contour?
For the moment, a suitable workaround seems to be to do
where the background colour is white. This generates what I'm after.
I notice also that linewidths is mentioned in the docstring under Obsolete:, but it seems to do nothing, so it should probably be removed from the docstring.
---- Eric Firing <efiring@...202...> wrote:
Gary Ruben wrote:
> I'm notice that contourf behaves differently to contour by default in
> where it decides to position contours. For example, using pylab, if you try
> I'd have expected the contours to line up, but they don't. Is there a
> way to get contourf to place its contours at the same position as contour?
Specify the same number of levels:
That takes care of this simple case. There are other cases, however,
where contour and contourf simply don't agree; contouring is ambiguous,
and only part of the algorithm is shared between contour and contourf.
For well-behaved datasets this is normally not a problem, but it becomes
obvious if you contour a random array.