[Matplotlib-users] Pcolormesh vs contourf
sameer.grover.1 at gmail.com
Sat Jan 7 16:38:41 EST 2017
Hi Jody, Eric,
On 8 January 2017 at 02:01, Jody Klymak <jklymak at uvic.ca> wrote:
> Hi Eric, Sameer
> I view the way pcolormesh handles x and y as fundamental, so I am
> reluctant to add an option to interpolate/extrapolate a pixel-centered grid
> to the the edge grid that pcolormesh absolutely requires. In the simplest
> cases, such as a uniform rectangular grid, such a transformation is
> straightforward, but in the more general cases that pcolormesh handles, it
> is not; there is no single algorithm that would "do the right thing" in all
> Maybe I’ve misunderstood, but in 1.5.x, if I run pcolormesh with len(x) =
> m, len(y) = n and size(z) = m,n then it works just fine (like matlab’s
> implimentation). its great that it also does m+1 and n+1, but I think it
> does the “easy” thing. Maybe in 2.0 this has changed?
> To the original question: pcolormesh(x,y,z,rasterized=True) is your
> friend if m and n are large and you want to print things.
> Cheers, Jody
What I meant was that pcolormesh(z) gives an identical output to
pcolormesh(range(m),range(n),z), only when z.shape is (n-1,m-1). It does
work when z.shape=(m,n) by omitting the last quadrilateral. I thought it
more correct (for my use case) that the number of quadrilaterals should be
the number of elements in x or y.
> There is scope for making it easier to do common things, but rather than
> fold it into functions like pcolormesh, I think it is better to break it
> out into standalone grid manipulation functions.
> We also have a NonuniformImage class that handles irregular (and regular)
> rectangular pixel-centered grids, and can be used directly. That class
> needs an Axes method and a pyplot function.
Thanks for the information about the nonuniformimage class.
> It's not hard to do but something that could be considered if there are
> enough use cases.
> Matplotlib-users mailing list
> Matplotlib-users at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Matplotlib-users