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

Commitd7fd405

Browse files
Create unit test for boxarrow head adjustment
1 parent0ea2f5a commitd7fd405

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed
Binary file not shown.

‎lib/matplotlib/tests/test_arrow_patches.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,32 @@ def test_boxarrow():
4949
bbox=dict(boxstyle=stylename,fc="w",ec="k"))
5050

5151

52-
@image_comparison(['roadsign_test_image.png'])
53-
deftemp_test_boxarrow():
52+
@image_comparison(['boxarrow_adjustment_test_image.png'])
53+
deftest_boxarrow_adjustment():
5454

5555
styles=mpatches.BoxStyle.get_styles()
5656

57-
n=len(styles)
58-
spacing=1.2
57+
repetitions=2
58+
spacing=2.4
5959

60-
figheight= (n*spacing+.5)
60+
figheight= (3*repetitions*spacing+.5)
6161
fig=plt.figure(figsize=(4/1.5,figheight/1.5))
6262

6363
fontsize=0.3*72
6464

65-
fori,stylenameinenumerate(sorted(styles)):
66-
ifstylenamein ("larrow","rarrow","darrow"):
67-
fig.text(0.5, ((n-i)*spacing-0.5)/figheight,stylename,
68-
ha="center",
69-
size=fontsize,
70-
transform=fig.transFigure,
71-
bbox=dict(boxstyle=stylename+",head_width=1",fc="w",
72-
ec="k"))
65+
angle=-80
66+
angle_step=120/repetitions
67+
foriinrange(repetitions):
68+
forj,stylenameinenumerate(sorted(styles)):
69+
ifstylenamein ("larrow","rarrow","darrow"):
70+
fig.text(0.5, ((3*repetitions-i-j)*spacing-0.5)/figheight,
71+
stylename,
72+
ha="center",
73+
size=fontsize,
74+
transform=fig.transFigure,
75+
rotation=angle,
76+
bbox=dict(boxstyle=stylename+f",head_width={(i+j)/2},head_angle={angle}",fc="w",ec="k"))
77+
angle=angle+angle_step
7378

7479

7580
def__prepare_fancyarrow_dpi_cor_test():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp