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

Commitf49904c

Browse files
committed
add test
1 parent08bc831 commitf49904c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎lib/matplotlib/tests/test_legend.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,3 +1391,17 @@ def test_legend_nolabels_draw():
13911391
plt.plot([1,2,3])
13921392
plt.legend()
13931393
assertplt.gca().get_legend()isnotNone
1394+
1395+
1396+
deftest_legend_key_patch():
1397+
"""Test that legend key entries are patches"""
1398+
fig,axs=plt.subplots()
1399+
A=5*np.random.rand(100,1)
1400+
B=10*np.random.rand(100,1)-5
1401+
C=7*np.random.rand(100,1)-5
1402+
bp0=axs.boxplot(A,positions=[0],patch_artist=True)
1403+
bp1=axs.boxplot(B,positions=[1],patch_artist=True)
1404+
bp2=axs.boxplot(C,positions=[2],patch_artist=True)
1405+
legend=axs.legend(['A','B','C'])
1406+
foriinlegend.legend_handles:
1407+
assertisinstance(i,mpl.patches.Rectangle)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp