Fixes #12926 - inconsistency upon passing C in hexbin by krooijers · Pull Request #26113 · matplotlib/matplotlib · GitHub
Skip to content

Fixes #12926 - inconsistency upon passing C in hexbin - #26113

Merged
oscargus merged 2 commits into
matplotlib:mainfrom
krooijers:bugfix-for-issue-12926
Jun 13, 2023
Merged

oscargus merged 2 commits into
matplotlib:mainfrom
krooijers:bugfix-for-issue-12926

Conversation

@krooijers

@krooijers krooijers commented Jun 12, 2023

Copy link
Copy Markdown
Contributor

PR summary

Closes #12926

Around line 4998 in _axes.py two code paths diverge, depending on whether parameter C is given. The strict inequality between accum and mincnt in L5003 when C == None is not symmetric to the strict inequality at L5017, when C != None. This causes data points to become "hidden", when the number of data points (accum) is equal to mincnt.

'Tis but a scratch: changing > mincnt to >= mincnt was enough to get consistent hexbin plots.

hexbin result before

image

hexbin result after

image

PR checklist

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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 week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

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

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

@oscargus

Copy link
Copy Markdown
Member

@oscargus oscargus added this to the v3.8.0 milestone Jun 13, 2023
@krooijers

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look, @oscargus

I've added a test test_hexbin_mincnt_behavior_upon_C_parameter and verified that indeed it does fail without the fix, and passes with the fix.

@oscargus oscargus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Thanks!

@ksunden

ksunden commented Jun 13, 2023

Copy link
Copy Markdown
Member

Anyone can merge on green CI

@oscargus
oscargus merged commit 584cda0 into matplotlib:main Jun 13, 2023
@oscargus

Copy link
Copy Markdown
Member

Thanks @krooijers and congrats on your first merged PR in Matplotlib. Hope to see you around!

@anntzer

anntzer commented Jul 14, 2023

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Inconsistent behavior of hexbins mincnt parameter, depending on C parameter

5 participants