Skip to content

Commit 785140b

Browse files
author
ellie
committed
Addressed diagram feedback and simplified annotation calls
1 parent dd7f51b commit 785140b

File tree

1 file changed

+14
-11
lines changed

1 file changed

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

33

4-
def arrow(p1, p2, **props):
5-
overlay.annotate(
6-
"", p1, p2, xycoords='figure fraction',
7-
arrowprops=dict(arrowstyle="<->", shrinkA=0, shrinkB=0, **props))
8-
94
fig, axs = plt.subplots(2, 2, figsize=(6.5, 4))
105
fig.set_facecolor('lightblue')
116
fig.subplots_adjust(0.1, 0.1, 0.9, 0.9, 0.4, 0.4)
127

138
overlay = fig.add_axes([0, 0, 1, 1], zorder=100)
149
overlay.axis("off")
10+
xycoords='figure fraction'
11+
arrowprops=dict(arrowstyle="<->", shrinkA=0, shrinkB=0)
1512

1613
for ax in axs.flat:
1714
ax.set(xticks=[], yticks=[])
1815

19-
arrow((0, 0.75), (0.1, 0.75)) # left
20-
arrow((0.435, 0.25), (0.565, 0.25)) # wspace
21-
arrow((0, 0.8), (0.9, 0.8)) # right
16+
overlay.annotate("", (0, 0.75), (0.1, 0.75),
17+
xycoords=xycoords, arrowprops=arrowprops) # left
18+
overlay.annotate("", (0.435, 0.25), (0.565, 0.25),
19+
xycoords=xycoords, arrowprops=arrowprops) # wspace
20+
overlay.annotate("", (0, 0.8), (0.9, 0.8),
21+
xycoords=xycoords, arrowprops=arrowprops) # right
2222
fig.text(0.05, 0.7, "left", ha="center")
2323
fig.text(0.5, 0.3, "wspace", ha="center")
2424
fig.text(0.05, 0.83, "right", ha="center")
2525

26-
arrow((0.75, 0), (0.75, 0.1)) # bottom
27-
arrow((0.25, 0.435), (0.25, 0.565)) # hspace
28-
arrow((0.80, 0), (0.8, 0.9)) # top
26+
overlay.annotate("", (0.75, 0), (0.75, 0.1),
27+
xycoords=xycoords, arrowprops=arrowprops) # bottom
28+
overlay.annotate("", (0.25, 0.435), (0.25, 0.565),
29+
xycoords=xycoords, arrowprops=arrowprops) # hspace
30+
overlay.annotate("", (0.8, 0), (0.8, 0.9),
31+
xycoords=xycoords, arrowprops=arrowprops) # top
2932
fig.text(0.65, 0.05, "bottom", va="center")
3033
fig.text(0.28, 0.5, "hspace", va="center")
3134
fig.text(0.82, 0.05, "top", va="center")

0 commit comments

Comments
 (0)