MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_patch_custom_linestyle

Function test_patch_custom_linestyle

lib/matplotlib/tests/test_patches.py:344–369  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

342
343@image_comparison(['patch_custom_linestyle'], remove_text=True, style='_classic_test')
344def test_patch_custom_linestyle():
345 #: A test to check that patches and collections accept custom dash
346 #: patterns as linestyle and that they display correctly.
347 star = mpath.Path.unit_regular_star(6)
348 circle = mpath.Path.unit_circle()
349 # concatenate the star with an internal cutout of the circle
350 verts = np.concatenate([circle.vertices, star.vertices[::-1]])
351 codes = np.concatenate([circle.codes, star.codes])
352 cut_star1 = mpath.Path(verts, codes)
353 cut_star2 = mpath.Path(verts + 1, codes)
354
355 ax = plt.axes()
356 col = mcollections.PathCollection(
357 [cut_star2],
358 linewidth=5, linestyles=[(0, (5, 7, 10, 7))],
359 facecolor=(1, 0, 0), edgecolor=(0, 0, 1))
360 ax.add_collection(col)
361
362 patch = mpatches.PathPatch(
363 cut_star1,
364 linewidth=5, linestyle=(0, (5, 7, 10, 7)),
365 facecolor=(1, 0, 0), edgecolor=(0, 0, 1))
366 ax.add_patch(patch)
367
368 ax.set_xlim(-1, 2)
369 ax.set_ylim(-1, 2)
370
371
372def test_patch_linestyle_accents():

Callers

nothing calls this directly

Calls 7

unit_regular_starMethod · 0.80
unit_circleMethod · 0.80
add_collectionMethod · 0.80
add_patchMethod · 0.80
axesMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…