|
32 | 32 | _gridline_param_names = ['grid_' + name
|
33 | 33 | for name in _line_param_names + _line_param_aliases]
|
34 | 34 |
|
| 35 | +_NoRecursionMarker = object() |
| 36 | + |
35 | 37 |
|
36 | 38 | class Tick(martist.Artist):
|
37 | 39 | """
|
@@ -1225,15 +1227,19 @@ def _set_lim(self, v0, v1, *, emit=True, auto):
|
1225 | 1227 | if auto is not None:
|
1226 | 1228 | self._set_autoscale_on(bool(auto))
|
1227 | 1229 |
|
| 1230 | + # Undocumented internal feature: setting emit to _NoRecursionMarker causes |
| 1231 | + # signal emission but doesn't propagate to shared axed (thus preventing |
| 1232 | + # infinite recursion). |
1228 | 1233 | if emit:
|
1229 | 1234 | self.axes.callbacks.process(f"{name}lim_changed", self.axes)
|
1230 |
| - # Call all of the other axes that are shared with this one |
1231 |
| - for other in self._get_shared_axes(): |
1232 |
| - if other is not self.axes: |
1233 |
| - other._axis_map[name]._set_lim( |
1234 |
| - v0, v1, emit=False, auto=auto) |
1235 |
| - if other.figure != self.figure: |
1236 |
| - other.figure.canvas.draw_idle() |
| 1235 | + if emit != _NoRecursionMarker: |
| 1236 | + # Call all of the other axes that are shared with this one |
| 1237 | + for other in self._get_shared_axes(): |
| 1238 | + if other is not self.axes: |
| 1239 | + other._axis_map[name]._set_lim( |
| 1240 | + v0, v1, emit=_NoRecursionMarker, auto=auto) |
| 1241 | + if other.figure != self.figure: |
| 1242 | + other.figure.canvas.draw_idle() |
1237 | 1243 |
|
1238 | 1244 | self.stale = True
|
1239 | 1245 | return v0, v1
|
|
0 commit comments