Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FIX: ValueError when hexbin is run with empty arrays and log scaling.#23944

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 3 commits intomatplotlib:mainfromerykoff:gh23922
Sep 23, 2022

Conversation

erykoff
Copy link
Contributor

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@erykoff
Copy link
ContributorAuthor

This PR addresses#23922

Copy link

@github-actionsgithub-actionsbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping@matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

We strive to be a welcoming and open project. Please follow ourCode of Conduct.

@tacaswelltacaswell added this to thev3.6.1 milestoneSep 19, 2022
self.vmax = A.max()
# Ensure that A has non-zero size to compute min/max.
# Otherwise put in filler values.
if A.size:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is hittingalot of use cases as all of the color mappables to through here, would it be possible to do this check inhexbin instead?

If we do this here, do we want to use the same logic from the auto limit on the Axis to sure min != max (which I forsee causing divide by 0 errors later)?

self.vmax = A.max()
else:
self.vmin = 0.0
self.vmax = 0.0
Copy link
Contributor

@anntzeranntzerSep 19, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Setting these values to zero seems almost certainly wrong; the pre-#21989 behavior was (I think?) to set them to np.ma.masked (I think?) which also seems a bit strange but already better.

@erykoff
Copy link
ContributorAuthor

Please take a look now. I pushed the fix further upstream and also usedmasked instead of0.0. Maybe you have some more elegant ideas; however, this does fix the problem and pass the additional test without touching non-hexbin optimized code paths.

Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good to me - thanks for the PR!

@timhoffmtimhoffm merged commit0636b9e intomatplotlib:mainSep 23, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestSep 23, 2022
@timhoffm
Copy link
Member

Thanks@erykoff and congratulations on your first contribution to Matplotlib.

QuLogic added a commit that referenced this pull requestSep 23, 2022
…944-on-v3.6.xBackport PR#23944 on branch v3.6.x (FIX: ValueError when hexbin is run with empty arrays and log scaling.)
melissawm pushed a commit to melissawm/matplotlib that referenced this pull requestDec 19, 2022
…matplotlib#23944)* Add test for empty hexbin with log scaling.* Use guarded autoscale_None for use when vmin/vmax are None.* Add additional check when auto vmin/vmax are None.
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@anntzeranntzeranntzer left review comments

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@timhoffmtimhoffmtimhoffm approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.6.1
Development

Successfully merging this pull request may close these issues.

5 participants
@erykoff@timhoffm@tacaswell@anntzer@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp