|
| 1 | +import matplotlib.pyplot as plt |
| 2 | + |
| 3 | +def arrow(p1, p2, **props): |
| 4 | + axs[0, 0].annotate( |
| 5 | + "", p1, p2, xycoords='figure fraction', |
| 6 | + arrowprops=dict(arrowstyle="<->", shrinkA=0, shrinkB=0, **props)) |
| 7 | + |
| 8 | +fig, axs = plt.subplots(2, 2, figsize=(6.5, 4)) |
| 9 | +fig.set_facecolor('lightblue') |
| 10 | +fig.subplots_adjust(0.1, 0.1, 0.9, 0.9, 0.4, 0.4) |
| 11 | +for ax in axs.flat: |
| 12 | + ax.set(xticks=[], yticks=[]) |
| 13 | + |
| 14 | +arrow((0, 0.75), (0.1, 0.75)) # left |
| 15 | +arrow((0.435, 0.75), (0.565, 0.75)) # wspace |
| 16 | +arrow((0.9, 0.75), (1, 0.75)) # right |
| 17 | +fig.text(0.05, 0.7, "left", ha="center") |
| 18 | +fig.text(0.5, 0.7, "wspace", ha="center") |
| 19 | +fig.text(0.95, 0.7, "right", ha="center") |
| 20 | + |
| 21 | +arrow((0.25, 0), (0.25, 0.1)) # bottom |
| 22 | +arrow((0.25, 0.435), (0.25, 0.565)) # hspace |
| 23 | +arrow((0.25, 0.9), (0.25, 1)) # top |
| 24 | +fig.text(0.28, 0.05, "bottom", va="center") |
| 25 | +fig.text(0.28, 0.5, "hspace", va="center") |
| 26 | +fig.text(0.28, 0.95, "top", va="center") |
0 commit comments