Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9c01223

Browse files
committed
DOC: Slightly further improve arrowstyle demo
- use straight lines- use monospace font for the style names- adjust positions and colors so that the arrows stand out more
1 parenta9dc9ac commit9c01223

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

‎galleries/examples/text_labels_and_annotations/fancyarrow_demo.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
Annotation arrow style reference
44
================================
55
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.
711
"""
812

913
importinspect
@@ -21,29 +25,30 @@
2125
.add_gridspec(1+nrow,ncol,
2226
wspace=0,hspace=0,left=0,right=1,bottom=0,top=1).subplots())
2327
foraxinaxs.flat:
24-
ax.set_xlim(-0.5,4)
28+
ax.set_xlim(-0.1,4)
2529
ax.set_axis_off()
2630
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")
2933
forax, (stylename,stylecls)inzip(axs[1:, :].T.flat,styles.items()):
3034
# 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",
3439
arrowprops=dict(
35-
arrowstyle=stylename,connectionstyle="arc3,rad=-0.05",
40+
arrowstyle=stylename,connectionstyle="arc3,rad=0",
3641
color="k",shrinkA=5,shrinkB=5,patchB=l,
3742
),
38-
bbox=dict(boxstyle="square",fc="w",ec="grey"))
43+
bbox=dict(boxstyle="square",fc="w",ec="lightgrey"))
3944
# draw default parameters
4045
# wrap at every nth comma (n = 1 or 2, depending on text length)
4146
s=str(inspect.signature(stylecls))[1:-1]
4247
n=2ifs.count(',')>3else1
43-
ax.text(1.25,0,
48+
ax.text(1.4,0,
4449
re.sub(', ',lambdam,c=itertools.count(1):m.group()
4550
ifnext(c)%nelse'\n',s),
46-
verticalalignment="center")
51+
verticalalignment="center",color="0.3")
4752

4853
plt.show()
4954

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp