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

Commit005677f

Browse files
authored
Merge pull request#29786 from meeseeksmachine/auto-backport-of-pr-29755-on-v3.10.x
Backport PR#29755 on branch v3.10.x (DOC: Simplify annotation arrow style reference)
2 parents2736c12 +ac6495f commit005677f

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

‎galleries/examples/text_labels_and_annotations/fancyarrow_demo.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,31 @@
1919
nrow= (len(styles)+1)//ncol
2020
axs= (plt.figure(figsize=(4*ncol,1+nrow))
2121
.add_gridspec(1+nrow,ncol,
22-
wspace=.7,left=.1,right=.9,bottom=0,top=1).subplots())
22+
wspace=0,hspace=0,left=0,right=1,bottom=0,top=1).subplots())
2323
foraxinaxs.flat:
24+
ax.set_xlim(-0.5,4)
2425
ax.set_axis_off()
2526
foraxinaxs[0, :]:
26-
ax.text(0,.5,"arrowstyle",
27-
transform=ax.transAxes,size="large",color="tab:blue",
28-
horizontalalignment="center",verticalalignment="center")
29-
ax.text(.35,.5,"default parameters",
30-
transform=ax.transAxes,
31-
horizontalalignment="left",verticalalignment="center")
27+
ax.text(-0.25,0.5,"arrowstyle",size="large",color="tab:blue")
28+
ax.text(1.25,.5,"default parameters",size="large")
3229
forax, (stylename,stylecls)inzip(axs[1:, :].T.flat,styles.items()):
33-
l,=ax.plot(.25,.5,"ok",transform=ax.transAxes)
34-
ax.annotate(stylename, (.25,.5), (-0.1,.5),
35-
xycoords="axes fraction",textcoords="axes fraction",
36-
size="large",color="tab:blue",
37-
horizontalalignment="center",verticalalignment="center",
30+
# 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",
3834
arrowprops=dict(
3935
arrowstyle=stylename,connectionstyle="arc3,rad=-0.05",
4036
color="k",shrinkA=5,shrinkB=5,patchB=l,
4137
),
42-
bbox=dict(boxstyle="square",fc="w"))
38+
bbox=dict(boxstyle="square",fc="w",ec="grey"))
39+
# draw default parameters
4340
# wrap at every nth comma (n = 1 or 2, depending on text length)
4441
s=str(inspect.signature(stylecls))[1:-1]
4542
n=2ifs.count(',')>3else1
46-
ax.text(.35,.5,
43+
ax.text(1.25,0,
4744
re.sub(', ',lambdam,c=itertools.count(1):m.group()
4845
ifnext(c)%nelse'\n',s),
49-
transform=ax.transAxes,
50-
horizontalalignment="left",verticalalignment="center")
46+
verticalalignment="center")
5147

5248
plt.show()
5349

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp