-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
BUG: PcolorImage handles non-contiguous arrays, provides data readout #6930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
@@ -985,6 +985,15 @@ def set_data(self, x, y, A): | |||
self.is_grayscale = True | |||
else: | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.pcolor2
function. It requires that all three input arrays be contiguous, so I appended_contiguous
to the converters forx
andy
.To verify both the data cursor and the ability to handle non-contiguous inputs,