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

Commit43947b7

Browse files
committed
Added new test and comments
1 parent6a1d20e commit43947b7

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎lib/matplotlib/tests/test_path.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,13 @@ def test_make_compound_path_stops():
242242
assertnp.sum(compound_path.codes==Path.STOP)==0
243243

244244

245+
deftest_path_sketch_seed():
246+
# the default value of path.sketch_seed should be 0
247+
assertrcParams['path.sketch_seed']==0
248+
249+
245250
deftest_xkcd_seed_update():
251+
# when passing a seed to xkcd, the global rcParam should be updated
246252
withplt.xkcd(seed=2000):
247253
assertrcParams['path.sketch_seed']==2000
248254

@@ -284,7 +290,9 @@ def test_artist_seed():
284290
ln[0].set_sketch_params(3,120,40,2000)
285291

286292
# set_sketch_params seed should override seed set by rcParam
287-
rcParams['path.sketch_seed']=0
293+
# when seed is passed in set_sketch, it should be used
294+
# else rcParam should be used as seed
295+
rcParams['path.sketch_seed']=59856
288296
ln_2=ax.plot(x,y_2,color='green')
289297
ln_2[0].set_sketch_params(3,120,40,19680801)
290298

@@ -306,8 +314,10 @@ def test_xkcd_seed():
306314
ln=ax.plot(x,y_1,color='black')
307315
ln[0].set_sketch_params(3,120,40)
308316

309-
# xkcd should override rcParam seed.
310-
rcParams['path.sketch_seed']=0
317+
# xkcd should override rcParam seed
318+
# when seed is passed in xkcd, it should be used,else rcParam should be used as seed
319+
# passing seed to xkcd should also update global rcParam
320+
rcParams['path.sketch_seed']=8448
311321
withplt.xkcd(3,120,40,seed=420):
312322
ln_2=ax.plot(x,y_2,color='orange')
313323

@@ -318,6 +328,8 @@ def test_path_seed():
318328
y_1=20*np.sin(x)
319329
y_2=20*np.sin(x)+10
320330
fig,ax=plt.subplots()
331+
332+
# if no seed is passed in set_sketch, rcParam should be used as seed
321333
rcParams['path.sketch_seed']=645
322334
ln=ax.plot(x,y_1,color='blue')
323335
ln[0].set_sketch_params(3,120,40)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp