|
| 1 | +import matplotlib.patches as mpatches |
| 2 | +import matplotlib.pyplot as plt |
| 3 | + |
| 4 | +styles = mpatches.ArrowStyle.get_styles() |
| 5 | + |
| 6 | +figheight = (len(styles)+.5) |
| 7 | +fig1 = plt.figure(1, (4, figheight)) |
| 8 | +fontsize = 0.3 * fig1.dpi |
| 9 | + |
| 10 | +ax = plt.Axes(fig1, [0, 0, 1, 1], frameon=False, aspect=1.) |
| 11 | +fig1.add_axes(ax) |
| 12 | + |
| 13 | +ax.set_xlim(0, 4) |
| 14 | +ax.set_ylim(0, figheight) |
| 15 | + |
| 16 | +for i, (stylename, styleclass) in enumerate(sorted(styles.items())): |
| 17 | + y = (float(len(styles)) -0.25 - i) # /figheight |
| 18 | + p = mpatches.Circle((3.2, y), 0.2, fc="w") |
| 19 | + ax.add_patch(p) |
| 20 | + #ax.plot([0.8], [y], "o", mec="b", mfc="w", ms=20, transform=fig1.transFigure) |
| 21 | + #ax.scatter([0.8], [y], s=20*20, marker="o", edgecolors=["b"], facecolors=["w"], |
| 22 | + # ) |
| 23 | + ax.annotate(stylename, (3.2, y), |
| 24 | + (2., y), |
| 25 | + #xycoords="figure fraction", textcoords="figure fraction", |
| 26 | + ha="right", va="center", |
| 27 | + size=fontsize, |
| 28 | + arrowprops=dict(arrowstyle=stylename, |
| 29 | + patchB=p, |
| 30 | + shrinkA=5, |
| 31 | + shrinkB=5, |
| 32 | + fc="w", ec="k", |
| 33 | + connectionstyle="arc3,rad=-0.05", |
| 34 | + ), |
| 35 | + bbox=dict(boxstyle="square", fc="w")) |
| 36 | + |
| 37 | +ax.xaxis.set_visible(False) |
| 38 | +ax.yaxis.set_visible(False) |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +plt.draw() |
| 43 | +plt.show() |
0 commit comments