-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix ValueError being raised when plotting hist and hexbin on empty dataset (Fix #3886) #4119
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e864d94
Fix hexbin raising ValueError on empty dataset
287a815
Fix hist raising ValueError on empty dataset
6deba68
Add explanation for test_hist_empty
74a4266
Fix test_hist_empty and test_hexbin_empty test cases. Improve docstri…
a567658
Fix hist to return correct patches on empty input. Add test for hist …
2bf9777
Fix width and weights for hist on empty input. Update tests for empty…
22c6c7f
Fix hexbin to use len instead of any. Fix hist to pass in bin_range a…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix hist raising ValueError on empty dataset
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1005,6 +1005,9 @@ def test_hist_log(): | |
ax.hist(data, fill=False, log=True) | ||
|
||
|
||
def test_hist_empty(): | ||
ax.hist([]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as for the other test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
@image_comparison(baseline_images=['hist_steplog'], remove_text=True) | ||
def test_hist_steplog(): | ||
np.random.seed(0) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 want do draw no patches or patches of zero size? On consideration I think patches of zero size might be a better option here so client code which expects a non-zero length list does not have to check that it is true. For example if the user passes in bin edges, they should get back a list of zeros telling them that there are no counts in any of the bins.
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.
@efiring @mdboom @WeatherGod @pelson Thoughts, I think that this is an important API choice that needs to be made.