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

Commitfafc53c

Browse files
authored
Merge pull request#20696 from meeseeksmachine/auto-backport-of-pr-20662-on-v3.4.x
Backport PR#20662 on branch v3.4.x (Don't forget to disable autoscaling after interactive zoom.)
2 parentsd5de944 +10a2a40 commitfafc53c

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

‎lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4130,33 +4130,24 @@ def _set_view_from_bbox(self, bbox, direction='in',
41304130
Whether this axis is twinned in the *y*-direction.
41314131
"""
41324132
iflen(bbox)==3:
4133-
Xmin,Xmax=self.get_xlim()
4134-
Ymin,Ymax=self.get_ylim()
4135-
41364133
xp,yp,scl=bbox# Zooming code
4137-
41384134
ifscl==0:# Should not happen
41394135
scl=1.
4140-
41414136
ifscl>1:
41424137
direction='in'
41434138
else:
41444139
direction='out'
41454140
scl=1/scl
4146-
41474141
# get the limits of the axes
4148-
tranD2C=self.transData.transform
4149-
xmin,ymin=tranD2C((Xmin,Ymin))
4150-
xmax,ymax=tranD2C((Xmax,Ymax))
4151-
4142+
(xmin,ymin), (xmax,ymax)=self.transData.transform(
4143+
np.transpose([self.get_xlim(),self.get_ylim()]))
41524144
# set the range
41534145
xwidth=xmax-xmin
41544146
ywidth=ymax-ymin
41554147
xcen= (xmax+xmin)*.5
41564148
ycen= (ymax+ymin)*.5
41574149
xzc= (xp*(scl-1)+xcen)/scl
41584150
yzc= (yp*(scl-1)+ycen)/scl
4159-
41604151
bbox= [xzc-xwidth/2./scl,yzc-ywidth/2./scl,
41614152
xzc+xwidth/2./scl,yzc+ywidth/2./scl]
41624153
eliflen(bbox)!=4:
@@ -4209,8 +4200,10 @@ def _set_view_from_bbox(self, bbox, direction='in',
42094200

42104201
ifnottwinxandmode!="y":
42114202
self.set_xbound(new_xbound)
4203+
self.set_autoscalex_on(False)
42124204
ifnottwinyandmode!="x":
42134205
self.set_ybound(new_ybound)
4206+
self.set_autoscaley_on(False)
42144207

42154208
defstart_pan(self,x,y,button):
42164209
"""

‎lib/matplotlib/tests/test_backend_bases.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def test_interactive_zoom():
178178
tb.zoom()
179179
assertax.get_navigate_mode()isNone
180180

181+
assertnotax.get_autoscalex_on()andnotax.get_autoscaley_on()
182+
181183

182184
deftest_toolbar_zoompan():
183185
expected_warning_regex= (

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp