Skip to content
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

Squeeze post-converted values when validating limits #26597

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

ksunden
Copy link
Member

@ksunden ksunden commented Aug 25, 2023

PR summary

Closes #26596

Ensures that ndarrays can be passed to later on. In this particular case, we know that we expect a single value.

PR checklist

@ksunden ksunden added this to the v3.7.3 milestone Aug 25, 2023
Comment on lines 317 to 319
# Numpy 1.25 deprecated casting [2.] to float, catch_warnings added to error on main
# can be removed once the minimum numpy version has expired the warning
Copy link
Member

Choose a reason for hiding this comment

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

"to error on main" should be "to avoid error on main"? I'm pretty sure this test doesn't error...

Copy link
Member Author

Choose a reason for hiding this comment

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

I meant to error on main prior to this patch being applied

Comment on lines 319 to 323
with warnings.catch_warnings():
f, ax = plt.subplots()
ax.plot(["a", "b", "c", "d"], [1, 2, 3, 4])
ax.set_xlim("b", "c")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
with warnings.catch_warnings():
f, ax = plt.subplots()
ax.plot(["a", "b", "c", "d"], [1, 2, 3, 4])
ax.set_xlim("b", "c")
f, ax = plt.subplots()
ax.plot(["a", "b", "c", "d"], [1, 2, 3, 4])
with warnings.catch_warnings():
ax.set_xlim("b", "c")

lib/matplotlib/tests/test_category.py Outdated Show resolved Hide resolved
Comment on lines 317 to 319
# Numpy 1.25 deprecated casting [2.] to float, catch_warnings added to error on main
# can be removed once the minimum numpy version has expired the warning
Copy link
Member Author

Choose a reason for hiding this comment

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

I meant to error on main prior to this patch being applied

Comment on lines 317 to 319
# Numpy 1.25 deprecated casting [2.] to float, catch_warnings added to error on main
# can be removed once the minimum numpy version has expired the warning
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
# Numpy 1.25 deprecated casting [2.] to float, catch_warnings added to error on main
# can be removed once the minimum numpy version has expired the warning
# Numpy 1.25 deprecated casting [2.] to float, catch_warnings added to error
# without patch
# can be removed once the minimum numpy version has expired the warning

Closes matplotlib#26596

Ensures that ndarrays can be passed to  later on. In this particular case, we know that we expect a single value.
@QuLogic QuLogic merged commit 45a97b0 into matplotlib:main Aug 30, 2023
40 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 30, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 30, 2023
QuLogic added a commit that referenced this pull request Aug 31, 2023
…597-on-v3.7.x

Backport PR #26597 on branch v3.7.x (Squeeze post-converted values when validating limits)
ksunden added a commit that referenced this pull request Aug 31, 2023
…597-on-v3.8.x

Backport PR #26597 on branch v3.8.x (Squeeze post-converted values when validating limits)
@ksunden ksunden mentioned this pull request Sep 15, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Deprecation warning from numpy when setting limits on categorical axis with categories
3 participants