|
1 | 1 | import matplotlib.pyplot as plt
|
2 | 2 |
|
3 | 3 |
|
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 |
| - |
9 | 4 | fig, axs = plt.subplots(2, 2, figsize=(6.5, 4))
|
10 | 5 | fig.set_facecolor('lightblue')
|
11 | 6 | fig.subplots_adjust(0.1, 0.1, 0.9, 0.9, 0.4, 0.4)
|
12 | 7 |
|
13 | 8 | overlay = fig.add_axes([0, 0, 1, 1], zorder=100)
|
14 | 9 | overlay.axis("off")
|
| 10 | +xycoords='figure fraction' |
| 11 | +arrowprops=dict(arrowstyle="<->", shrinkA=0, shrinkB=0) |
15 | 12 |
|
16 | 13 | for ax in axs.flat:
|
17 | 14 | ax.set(xticks=[], yticks=[])
|
18 | 15 |
|
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 |
22 | 22 | fig.text(0.05, 0.7, "left", ha="center")
|
23 | 23 | fig.text(0.5, 0.3, "wspace", ha="center")
|
24 | 24 | fig.text(0.05, 0.83, "right", ha="center")
|
25 | 25 |
|
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 |
29 | 32 | fig.text(0.65, 0.05, "bottom", va="center")
|
30 | 33 | fig.text(0.28, 0.5, "hspace", va="center")
|
31 | 34 | fig.text(0.82, 0.05, "top", va="center")
|
0 commit comments