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

Skip to content

Commit 2ccc67f

Browse files
authored
Merge pull request #21866 from anntzer/aze
Shorten some inset_locator docstrings.
2 parents c0fc781 + 4e70548 commit 2ccc67f

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

examples/subplots_axes_and_figures/axes_zoom_effect.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,14 @@ def zoom_effect02(ax1, ax2, **kwargs):
109109
return c1, c2, bbox_patch1, bbox_patch2, p
110110

111111

112-
plt.figure(figsize=(5, 5))
113-
ax1 = plt.subplot(221)
114-
ax2 = plt.subplot(212)
115-
ax2.set_xlim(0, 1)
116-
ax2.set_xlim(0, 5)
117-
zoom_effect01(ax1, ax2, 0.2, 0.8)
118-
119-
120-
ax1 = plt.subplot(222)
121-
ax1.set_xlim(2, 3)
122-
ax2.set_xlim(0, 5)
123-
zoom_effect02(ax1, ax2)
112+
axs = plt.figure().subplot_mosaic([
113+
["zoom1", "zoom2"],
114+
["main", "main"],
115+
])
116+
117+
axs["main"].set(xlim=(0, 5))
118+
zoom_effect01(axs["zoom1"], axs["main"], 0.2, 0.8)
119+
axs["zoom2"].set(xlim=(2, 3))
120+
zoom_effect02(axs["zoom2"], axs["main"])
124121

125122
plt.show()

0 commit comments

Comments
 (0)