BUG: PcolorImage handles non-contiguous arrays, provides data readout#6930
BUG: PcolorImage handles non-contiguous arrays, provides data readout#6930tacaswell merged 2 commits intomatplotlib:masterfrom
Conversation
b52541d to
ebfe81d
Compare
|
Lots of unrelated failures: |
|
I fixed the unrelated error on master so cycling this to rerun on current master |
|
@mdboom, on second thought, what I characterized as a bug in _image.pcolor2 is better described as a limitation or requirement. Originally, PcolorImage was ensuring that x and y are contiguous. I broke that by indexing with |
| raise ValueError("3D arrays must have RGB or RGBA as last dim") | ||
|
|
||
| # For efficient cursor readout, ensure x and y are increasing. | ||
| if x[-1] < x[0]: |
There was a problem hiding this comment.
Do we enforce that x/y are monotonic someplace else?
If we bump the minimum numpy to 1.7, searchsorted takes in a sorter kwarg which is an array with the indexes in sorted order (https://docs.scipy.org/doc/numpy/reference/generated/numpy.searchsorted.html)
There was a problem hiding this comment.
No, we have never enforced monotonic x or y for any of the pcolor-like functions; that has implicitly been left to the user. If the user supplies non-monotonic x and/or y the plotted results will be odd, and with this PR as-is the cursor readout will sometimes be hard to predict--but the plot won't make sense anyway, so I don't see that it matters. So it seems to me that you are raising a question that is independent of this PR--should we add more input validation for this category of plot?
|
I am 👍 on this modulo my concern about x/y being monotonic. |
|
The travis mac infrastructure is down, merging as it previously passed an the new changes are docstring only. |
BUG: PcolorImage handles non-contiguous arrays, provides data readout
|
backported to v2.x as fab69a1 |
Closes #6905, and fixes a bug in the underlying
_image.pcolor2function. It requires that all three input arrays be contiguous, so I appended_contiguousto the converters forxandy.To verify both the data cursor and the ability to handle non-contiguous inputs,