-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use broadcast_like for 2d plot coordinates #5099
Conversation
Use broadcast_like if either `x` or `y` inputs are 2d to ensure that both have dimensions in the same order as the DataArray being plotted. Convert to numpy arrays after possibly using broadcast_like. Simplifies code, and fixes pydata#5097 (bug when dimensions have the same size).
OK I must be misremembering then. |
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.
Thanks for your patience! In your MVCE (#5097) compare h1.get_paths()[0]
and h2.get_paths()[0]
. Thus, you can use h2.get_paths()
for a test e.g.:
v = h2.get_paths()[0].vertices
assert not np.all(v[:, 0] == v[:, 1])
(in the MVCE all x and y coords are equal i.e. it's a diagonal with width 0).
I suggest merging this (pending a test if you are up to it), and if something breaks the interval resolution that is not tested we fix it later...
Co-authored-by: Mathias Hauser <[email protected]>
Thanks @mathause! I've used your suggestion to turn my MVCE into a test which fails on master, but passes with the fix in this PR. |
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.
LGTM. Let's see if someone else wants to comment and I'll merge in a day or two.
Thanks @johnomotani - fingers crossed that this does not break anything. |
Use broadcast_like if either
x
ory
inputs are 2d to ensure that both have dimensions in the same order as the DataArray being plotted. Convert to numpy arrays after possibly using broadcast_like. Simplifies code, and fixes #5097 (bug when dimensions have the same size).@dcherian
This change seems to 'just work', and unit tests pass. Is there some extra check that needs doing to make sure "resolving intervals" is behaving correctly?
I can't think of a unit test that would have caught #5097, since even when the bug happens, a plot is produced without errors or warnings. If anyone has an idea, suggestions/pushes welcome!
x
andy
#5097pre-commit run --all-files
whats-new.rst