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

Commitfba6973

Browse files
committed
Fix tests
1 parent7b911c2 commitfba6973

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎lib/matplotlib/axes/_base.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,7 @@ def set_xbound(self, lower=None, upper=None):
30453045
ifupperisNoneandnp.iterable(lower):
30463046
lower,upper=lower
30473047

3048-
old_lower,old_upper=self.get_xbound()
3048+
old_lower,old_upper=self.get_xbound(units=False)
30493049

30503050
iflowerisNone:
30513051
lower=old_lower
@@ -3087,7 +3087,6 @@ def get_xlim(self, units=True):
30873087
-----
30883088
The x-axis may be inverted, in which case the *left* value will
30893089
be greater than the *right* value.
3090-
30913090
"""
30923091
ifunits:
30933092
returnself._convert_back_lim(self.viewLim.intervalx,self.xaxis)
@@ -3425,7 +3424,7 @@ def yaxis_inverted(self):
34253424
"""
34263425
returnself.yaxis.get_inverted()
34273426

3428-
defget_ybound(self):
3427+
defget_ybound(self,units=True):
34293428
"""
34303429
Return the lower and upper y-axis bounds, in increasing order.
34313430
@@ -3440,7 +3439,7 @@ def get_ybound(self):
34403439
get_ylim, set_ylim
34413440
invert_yaxis, yaxis_inverted
34423441
"""
3443-
bottom,top=self.get_ylim()
3442+
bottom,top=self.get_ylim(units=units)
34443443
ifbottom<top:
34453444
returnbottom,top
34463445
else:
@@ -3468,7 +3467,7 @@ def set_ybound(self, lower=None, upper=None):
34683467
ifupperisNoneandnp.iterable(lower):
34693468
lower,upper=lower
34703469

3471-
old_lower,old_upper=self.get_ybound()
3470+
old_lower,old_upper=self.get_ybound(units=False)
34723471

34733472
iflowerisNone:
34743473
lower=old_lower

‎lib/matplotlib/tests/test_axes.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6471,7 +6471,10 @@ def test_datetime_masked():
64716471
fig,ax=plt.subplots()
64726472
ax.plot(x,m)
64736473
# these are the default viewlim
6474-
assertax.get_xlim()== (730120.0,733773.0)
6474+
assertax.get_xlim(units=False)== (730120.0,733773.0)
6475+
assert (ax.get_xlim(units=True)==
6476+
(datetime.datetime(2000,1,1,tzinfo=datetime.timezone.utc),
6477+
datetime.datetime(2010,1,1,tzinfo=datetime.timezone.utc)))
64756478

64766479

64776480
deftest_hist_auto_bins():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp