X Tutup
Skip to content

Squeeze post-converted values when validating limits#26597

Merged
QuLogic merged 1 commit intomatplotlib:mainfrom
ksunden:squeeze_lims
Aug 30, 2023
Merged

Squeeze post-converted values when validating limits#26597
QuLogic merged 1 commit intomatplotlib:mainfrom
ksunden:squeeze_lims

Conversation

@ksunden
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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")

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
Copy Markdown
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
Copy Markdown
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
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
wavebyrd pushed a commit to wavebyrd/matplotlib that referenced this pull request Mar 13, 2026
wavebyrd pushed a commit to wavebyrd/matplotlib that referenced this pull request Mar 13, 2026
…t-of-pr-26597-on-v3.7.x

Backport PR matplotlib#26597 on branch v3.7.x (Squeeze post-converted values when validating limits)
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

X Tutup