Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f952f3

Browse files
committed
Don't forget to disable autoscaling after interactive zoom.
(set_x/ybound doesn't disable autoscaling, unlike set_x/ylim.)
1 parent 1ea7cce commit 2f952f3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4362,8 +4362,10 @@ def _set_view_from_bbox(self, bbox, direction='in',
43624362

43634363
if not twinx and mode != "y":
43644364
self.set_xbound(new_xbound)
4365+
self.set_autoscalex_on(False)
43654366
if not twiny and mode != "x":
43664367
self.set_ybound(new_ybound)
4368+
self.set_autoscaley_on(False)
43674369

43684370
def start_pan(self, x, y, button):
43694371
"""

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
assert ax.get_navigate_mode() is None
180180

181+
assert not ax.get_autoscalex_on() and not ax.get_autoscaley_on()
182+
181183

182184
def test_toolbar_zoompan():
183185
expected_warning_regex = (

0 commit comments

Comments
 (0)