NonUniformImage class needs Axes method and pyplot function #7763

Open
efiring opened this Issue Jan 7, 2017 · 6 comments

Projects

None yet

2 participants

@efiring
Member
efiring commented Jan 7, 2017

The NonUniformImage class in image.py is potentially a good match for many use cases, but it is rarely used because it's high-level API is missing. It should be as accessible as imshow and pcolormesh.

@anntzer
Contributor
anntzer commented Jan 9, 2017

NonUniformImage ultimately relies on pcolor (see NonUniformImage.make_image), which is available in pyplot; is pcolor not sufficient for these purposes?

@efiring
Member
efiring commented Jan 9, 2017

pyplot.pcolor does not use _image.pcolor; it makes a PolyCollection.

@anntzer
Contributor
anntzer commented Jan 9, 2017

Interesting... Perhaps we should rename _image.pcolor to avoid the confusion? :-)

pcolorfast (which only exists as a method on the Axes class, not in pyplot) does propose an option to use PcolorImage, which relies ultimately on _image.pcolor2. Do you know the difference between _image.pcolor and image.pcolor2? Would exposing pcolorfast (perhaps under another name and with a slightly improved API) be enough?

@efiring
Member
efiring commented Jan 9, 2017

The difference is that _image.pcolor2 colors rectangles specified by their edges; image.pcolor takes rectangle centers, and includes an option for bilinear interpolation. Yes, the naming is confusing. Exposing pcolorfast, and/or the part of it that uses pcolor2, is probably overdue, but it is not a substitute for NonUniformImage, which is also in need of better exposure.

There is plenty of scope for improvements in this whole area, including factoring more chunks of related functionality out of _axes.py.

@efiring
Member
efiring commented Jan 9, 2017

Actually, I don't think the bilinear interpolation option in NonUniformImage is such a great idea. Without that, I think _image.pcolor could be dumped and everything could be done with pcolor2. NonUniformImage would just add an initial step, which could be at the python level, to make an edge grid based on the user's center grid.

I originally wrote pcolorfast because I use this type of plot quite a bit, often with an irregular rectangular grid. I hacked pcolor2 out of _image.pcolor.

@anntzer
Contributor
anntzer commented Jan 9, 2017

Perhaps remove the new-contributor-friendly tag? I don't think it's hard but this apparently needs some nontrivial API discussions. (Anyways, add it back if you disagree.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment