8000 Update diagram in subplots_adjust documentation to clarify parameter … · matplotlib/matplotlib@ac52254 · GitHub
[go: up one dir, main page]

Skip to content

Commit ac52254

Browse files
author
ellie
committed
Update diagram in subplots_adjust documentation to clarify parameter meaning
1 parent b4cb934 commit ac52254

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
import matplotlib.pyplot as plt
22

3-
43
def arrow(p1, p2, **props):
5-
axs[0, 0].annotate(
6-
"", p1, p2, xycoords='figure fraction',
4+
overlay.annotate(
5+
"", p1, p2, xycoords='figure fraction',
76
arrowprops=dict(arrowstyle="<->", shrinkA=0, shrinkB=0, **props))
87

9-
108
fig, axs = plt.subplots(2, 2, figsize=(6.5, 4))
119
fig.set_facecolor('lightblue')
1210
fig.subplots_adjust(0.1, 0.1, 0.9, 0.9, 0.4, 0.4)
11+
12+
overlay = fig.add_axes([0, 0, 1, 1], zorder=100)
13+
overlay.axis("off")
14+
1315
for ax in axs.flat:
1416
ax.set(xticks=[], yticks=[])
1517

1618
arrow((0, 0.75), (0.1, 0.75)) # left
17-
arrow((0.435, 0.75), (0.565, 0.75)) # wspace
18-
arrow((0.9, 0.75), (1, 0.75)) # right
19+
arrow((0.435, 0.25), (0.565, 0.25)) # wspace
20+
arrow((0.1, 0.8), (1, 0.8)) # right
1921
fig.text(0.05, 0.7, "left", ha="center")
20-
fig.text(0.5, 0.7, "wspace", ha="center")
21-
fig.text(0.95, 0.7, "right", ha="center")
22+
fig.text(0.5, 0.3, "wspace", ha="center")
23+
fig.text(0.95, 0.83, "right", ha="center")
2224

23-
arrow((0.25, 0), (0.25, 0.1)) # bottom
25+
arrow((0.75, 0), (0.75, 0.1)) # bottom
2426
arrow((0.25, 0.435), (0.25, 0.565)) # hspace
25-
arrow((0.25, 0.9), (0.25, 1)) # top
26-
fig.text(0.28, 0.05, "bottom", va="center")
27+
arrow((0.80, 0.1), (0.8, 1)) # top
28+
fig.text(0.65, 0.05, "bottom", va="center")
2729
fig.text(0.28, 0.5, "hspace", va="center")
28-
fig.text(0.28, 0.95, "top", va="center")
30+
fig.text(0.75, 0.95, "top", va="center")

0 commit comments

Comments
 (0)
0