Skip to content

Error on bad input to hexbin extents #27607

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 2 commits into from
Jan 11, 2024

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Jan 6, 2024

PR summary

If xmin/xmax or ymin/ymax are the wrong way around in hexbin(), raise an error. As noted in #18875 (which this is pulled from), this prevents issues with the hexbin marginals not being displayed at all if they are requested.

PR checklist

@dstansby dstansby marked this pull request as ready for review January 6, 2024 17:18
@@ -4999,6 +4999,10 @@ def reduce_C_function(C: array) -> float
ty = np.log10(ty)
if extent is not None:
xmin, xmax, ymin, ymax = extent
if xmin > xmax:
raise ValueError("In extent, xmin must be greater than xmax")
Copy link
Member

Choose a reason for hiding this comment

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

This error message is backwards (in both X and y)

@dstansby dstansby requested a review from ksunden January 8, 2024 20:18
@ksunden
Copy link
Member

ksunden commented Jan 8, 2024

Requires updating the new test as well

Copy link
Member

@ksunden ksunden left a comment

Choose a reason for hiding this comment

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

Looks like there was a network error affecting some CI; rerunning the main tests but assuming those are good, LGTM.

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@QuLogic QuLogic added this to the v3.9.0 milestone Jan 11, 2024
@QuLogic QuLogic merged commit b55c5bb into matplotlib:main Jan 11, 2024
@dstansby dstansby deleted the bad-hexbin-extent branch January 11, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants