|
3 | 3 | Annotation arrow style reference
|
4 | 4 | ================================
|
5 | 5 |
|
6 |
| -Overview of the arrow styles available in `~.Axes.annotate`. |
| 6 | +Overview of the available `.ArrowStyle` settings. These are used for the *arrowstyle* |
| 7 | +parameter of `~.Axes.annotate` and `.FancyArrowPatch`. |
| 8 | +
|
| 9 | +Each style can be configured with a set of parameters, which are stated along with |
| 10 | +their default values. |
7 | 11 | """
|
8 | 12 |
|
9 | 13 | importinspect
|
|
21 | 25 | .add_gridspec(1+nrow,ncol,
|
22 | 26 | wspace=0,hspace=0,left=0,right=1,bottom=0,top=1).subplots())
|
23 | 27 | foraxinaxs.flat:
|
24 |
| -ax.set_xlim(-0.5,4) |
| 28 | +ax.set_xlim(-0.1,4) |
25 | 29 | ax.set_axis_off()
|
26 | 30 | foraxinaxs[0, :]:
|
27 |
| -ax.text(-0.25,0.5,"arrowstyle",size="large",color="tab:blue") |
28 |
| -ax.text(1.25,.5,"default parameters",size="large") |
| 31 | +ax.text(0,0.5,"arrowstyle",size="large",color="tab:blue") |
| 32 | +ax.text(1.4,.5,"default parameters",size="large") |
29 | 33 | forax, (stylename,stylecls)inzip(axs[1:, :].T.flat,styles.items()):
|
30 | 34 | # draw dot and annotation with arrowstyle
|
31 |
| -l,=ax.plot(1,0,"o",color="grey") |
32 |
| -ax.annotate(stylename, (1,0), (0,0), |
33 |
| -size="large",color="tab:blue",ha="center",va="center", |
| 35 | +l,=ax.plot(1.25,0,"o",color="lightgrey") |
| 36 | +ax.annotate(stylename, (1.25,0), (0,0), |
| 37 | +size="large",color="tab:blue",ha="left",va="center", |
| 38 | +family="monospace", |
34 | 39 | arrowprops=dict(
|
35 |
| -arrowstyle=stylename,connectionstyle="arc3,rad=-0.05", |
| 40 | +arrowstyle=stylename,connectionstyle="arc3,rad=0", |
36 | 41 | color="k",shrinkA=5,shrinkB=5,patchB=l,
|
37 | 42 | ),
|
38 |
| -bbox=dict(boxstyle="square",fc="w",ec="grey")) |
| 43 | +bbox=dict(boxstyle="square",fc="w",ec="lightgrey")) |
39 | 44 | # draw default parameters
|
40 | 45 | # wrap at every nth comma (n = 1 or 2, depending on text length)
|
41 | 46 | s=str(inspect.signature(stylecls))[1:-1]
|
42 | 47 | n=2ifs.count(',')>3else1
|
43 |
| -ax.text(1.25,0, |
| 48 | +ax.text(1.4,0, |
44 | 49 | re.sub(', ',lambdam,c=itertools.count(1):m.group()
|
45 | 50 | ifnext(c)%nelse'\n',s),
|
46 |
| -verticalalignment="center") |
| 51 | +verticalalignment="center",color="0.3") |
47 | 52 |
|
48 | 53 | plt.show()
|
49 | 54 |
|
|