Skip to content

Commit d645f6a

Browse files
Replace is_twinned check with ax.get_position().bounds == prev_ax.get_position().bounds
1 parent ef0cedf commit d645f6a

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

‎plotly/matplotlylib/renderer.py‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,9 @@ def open_axes(self, ax, props):
226226

227227
overlay_ax_ct = None
228228
for prev_ax, prev_ct in self.axes_list:
229-
is_twinned = (
230-
(
231-
hasattr(ax, "_twinned_axes")
232-
and ax in ax._twinned_axes.get_siblings(prev_ax)
233-
)
234-
or getattr(ax, "_sharex", None) == prev_ax
235-
or getattr(ax, "_sharey", None) == prev_ax
236-
or getattr(prev_ax, "_sharex", None) == ax
237-
or getattr(prev_ax, "_sharey", None) == ax
238-
or (ax.get_position().bounds == prev_ax.get_position().bounds)
239-
)
240-
if is_twinned:
229+
# Overlay only axes that cover the same area. Shared-axis subplots, such
230+
# as the ones from plt.subplots(sharex=True), sit in different places.
231+
if ax.get_position().bounds == prev_ax.get_position().bounds:
241232
overlay_ax_ct = prev_ct
242233
break
243234

0 commit comments

Comments
 (0)