Skip to content

Error on bad input to hexbin extents#27607

Merged
QuLogic merged 2 commits intomatplotlib:mainfrom
dstansby:bad-hexbin-extent
Jan 11, 2024
Merged

Error on bad input to hexbin extents#27607
QuLogic merged 2 commits intomatplotlib:mainfrom
dstansby:bad-hexbin-extent

Conversation

@dstansby
Copy link
Copy Markdown
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
Comment thread lib/matplotlib/axes/_axes.py Outdated
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
Copy Markdown
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
Copy Markdown
Member

ksunden commented Jan 8, 2024

Requires updating the new test as well

Copy link
Copy Markdown
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.

Comment thread lib/matplotlib/tests/test_axes.py Outdated
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