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

Commit6956367

Browse files
committed
Added some tests for baseline features
1 parent707bf60 commit6956367

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

‎lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@ def tk_window_focus():
14521452
'matplotlib.tests.test_transforms',
14531453
'matplotlib.tests.test_triangulation',
14541454
'matplotlib.tests.test_widgets',
1455+
'matplotlib.tests.test_cycles',
14551456
'matplotlib.sphinxext.tests.test_tinypages',
14561457
'mpl_toolkits.tests.test_mplot3d',
14571458
'mpl_toolkits.tests.test_axes_grid1',

‎lib/matplotlib/tests/test_cycles.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
frommatplotlib.testing.decoratorsimportimage_comparison
2+
importmatplotlib.pyplotasplt
3+
importnumpyasnp
4+
5+
fromcyclerimportcycler
6+
7+
@image_comparison(baseline_images=['color_cycle_basic'],remove_text=True,
8+
extensions=['png'])
9+
deftest_colorcycle_basic():
10+
fig=plt.figure()
11+
ax=fig.add_subplot(111)
12+
ax.set_prop_cycle(cycler('color', ['r','g','y']))
13+
xs=np.arange(10)
14+
ys=0.25*xs+2
15+
ax.plot(xs,ys,label='red',lw=4)
16+
ys=0.45*xs+3
17+
ax.plot(xs,ys,label='green',lw=4)
18+
ys=0.65*xs+4
19+
ax.plot(xs,ys,label='yellow',lw=4)
20+
ys=0.85*xs+5
21+
ax.plot(xs,ys,label='red2',lw=4)
22+
ax.legend(loc='upper left')
23+
24+
25+
@image_comparison(baseline_images=['lineprop_cycle_basic'],remove_text=True,
26+
extensions=['png'])
27+
deftest_linestylecycle_basic():
28+
fig=plt.figure()
29+
ax=fig.add_subplot(111)
30+
ax.set_prop_cycle(cycler('linestyle', ['-','--',':']))
31+
xs=np.arange(10)
32+
ys=0.25*xs+2
33+
ax.plot(xs,ys,label='solid',lw=4)
34+
ys=0.45*xs+3
35+
ax.plot(xs,ys,label='dashed',lw=4)
36+
ys=0.65*xs+4
37+
ax.plot(xs,ys,label='dotted',lw=4)
38+
ys=0.85*xs+5
39+
ax.plot(xs,ys,label='solid2',lw=4)
40+
ax.legend(loc='upper left')
41+
42+
@image_comparison(baseline_images=['fill_cycle_basic'],remove_text=True,
43+
extensions=['png'])
44+
deftest_fillcycle_basic():
45+
fig=plt.figure()
46+
ax=fig.add_subplot(111)
47+
ax.set_prop_cycle(cycler('color', ['red','green','yellow']))# +
48+
#cycler('hatch', ['xx', 'O', '|-']))
49+
xs=np.arange(10)
50+
ys=0.25*xs**.5+2
51+
ax.fill(xs,ys,label='red, x')
52+
ys=0.45*xs**.5+3
53+
ax.fill(xs,ys,label='green, circle')
54+
ys=0.65*xs**.5+4
55+
ax.fill(xs,ys,label='yellow, cross')
56+
ys=0.85*xs**.5+5
57+
ax.fill(xs,ys,label='red2, x2')
58+
ax.legend(loc='upper left')
59+
60+
61+
if__name__=='__main__':
62+
importnose
63+
nose.runmodule(argv=['-s','--with-doctest'],exit=False)
64+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp