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

Commitd69b944

Browse files
committed
Emit xlim_changed on shared axes.
1 parent9333b45 commitd69b944

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

‎lib/matplotlib/axis.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,11 +1229,13 @@ def _set_lim(self, v0, v1, *, emit=True, auto):
12291229
self.axes.callbacks.process(f"{name}lim_changed",self.axes)
12301230
# Call all of the other axes that are shared with this one
12311231
forotherinself._get_shared_axes():
1232-
ifotherisnotself.axes:
1233-
other._axis_map[name]._set_lim(
1234-
v0,v1,emit=False,auto=auto)
1235-
ifother.figure!=self.figure:
1236-
other.figure.canvas.draw_idle()
1232+
ifotherisself.axes:
1233+
continue
1234+
other._axis_map[name]._set_lim(v0,v1,emit=False,auto=auto)
1235+
ifemit:
1236+
other.callbacks.process(f"{name}lim_changed",other)
1237+
ifother.figure!=self.figure:
1238+
other.figure.canvas.draw_idle()
12371239

12381240
self.stale=True
12391241
returnv0,v1

‎lib/matplotlib/tests/test_axes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8704,3 +8704,12 @@ def test_tick_param_labelfont():
87048704
plt.title('Title in sans-serif')
87058705
fortextinax.get_xticklabels():
87068706
asserttext.get_fontfamily()[0]=='monospace'
8707+
8708+
8709+
deftest_xylim_changed_shared():
8710+
fig,axs=plt.subplots(2,sharex=True,sharey=True)
8711+
events= []
8712+
axs[1].callbacks.connect("xlim_changed",events.append)
8713+
axs[1].callbacks.connect("ylim_changed",events.append)
8714+
axs[0].set(xlim=[1,3],ylim=[2,4])
8715+
assertevents== [axs[1],axs[1]]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp