Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Restore default behavior of hexbin mincnt with C provided#27179
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletionsdoc/api/next_api_changes/behavior/27179-KS.rst
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Default behavior of ``hexbin`` with *C* provided requires at least 1 point | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
The behavior changed in 3.8.0 to be inclusive of *mincnt*. However that resulted in | ||
errors or warnings with some reduction functions, so now the default is to require at | ||
least 1 point to call the reduction function. This effectively restores the default | ||
behavior to match that of Matplotlib 3.7 and before. |
6 changes: 6 additions & 0 deletionsdoc/api/prev_api_changes/api_changes_3.8.0/behaviour.rst
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
11 changes: 8 additions & 3 deletionslib/matplotlib/axes/_axes.py
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 |
---|---|---|
@@ -4873,8 +4873,8 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None, | ||
yscale : {'linear', 'log'}, default: 'linear' | ||
Use a linear or log10 scale on the vertical axis. | ||
mincnt : int >= 0, default: *None* | ||
If not *None*, only display cells withat least *mincnt* | ||
rcomer marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
number of points in the cell. | ||
marginals : bool, default: *False* | ||
@@ -4941,6 +4941,11 @@ def reduce_C_function(C: array) -> float | ||
- `numpy.sum`: integral of the point values | ||
- `numpy.amax`: value taken from the largest point | ||
By default will only reduce cells with at least 1 point because some | ||
reduction functions (such as `numpy.amax`) will error/warn with empty | ||
input. Changing *mincnt* will adjust the cutoff, and if set to 0 will | ||
pass empty input to the reduction function. | ||
data : indexable object, optional | ||
DATA_PARAMETER_PLACEHOLDER | ||
@@ -5038,7 +5043,7 @@ def reduce_C_function(C: array) -> float | ||
else: | ||
Cs_at_i2[i2[i]].append(C[i]) | ||
if mincnt is None: | ||
mincnt =1 | ||
accum = np.array( | ||
[reduce_C_function(acc) if len(acc) >= mincnt else np.nan | ||
for Cs_at_i in [Cs_at_i1, Cs_at_i2] | ||
2 changes: 2 additions & 0 deletionslib/matplotlib/tests/test_axes.py
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
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.