Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69961d6

Browse files
authored
Merge pull request#26653 from meeseeksmachine/auto-backport-of-pr-26597-on-v3.7.x
Backport PR#26597 on branch v3.7.x (Squeeze post-converted values when validating limits)
2 parents3c98167 +815ab8a commit69961d6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

‎lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3565,6 +3565,8 @@ def _validate_converted_limits(self, limit, convert):
35653565
"""
35663566
iflimitisnotNone:
35673567
converted_limit=convert(limit)
3568+
ifisinstance(converted_limit,np.ndarray):
3569+
converted_limit=converted_limit.squeeze()
35683570
if (isinstance(converted_limit,Real)
35693571
andnotnp.isfinite(converted_limit)):
35703572
raiseValueError("Axis limits cannot be NaN or Inf")

‎lib/matplotlib/tests/test_category.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Catch all for categorical functions"""
2+
importwarnings
3+
24
importpytest
35
importnumpyasnp
46

@@ -309,3 +311,13 @@ def test_hist():
309311
n,bins,patches=ax.hist(['a','b','a','c','ff'])
310312
assertn.shape== (10,)
311313
np.testing.assert_allclose(n, [2.,0.,0.,1.,0.,0.,1.,0.,0.,1.])
314+
315+
316+
deftest_set_lim():
317+
# Numpy 1.25 deprecated casting [2.] to float, catch_warnings added to error
318+
# with numpy 1.25 and prior to the change from gh-26597
319+
# can be removed once the minimum numpy version has expired the warning
320+
f,ax=plt.subplots()
321+
ax.plot(["a","b","c","d"], [1,2,3,4])
322+
withwarnings.catch_warnings():
323+
ax.set_xlim("b","c")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp