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

Function test_patch_alpha_override

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

Source from the content-addressed store, hash-verified

302
303@image_comparison(['patch_alpha_override'], remove_text=True, style='_classic_test')
304def test_patch_alpha_override():
305 #: Test checks that specifying an alpha attribute for a patch or
306 #: collection will override any alpha component of the facecolor
307 #: or edgecolor.
308 star = mpath.Path.unit_regular_star(6)
309 circle = mpath.Path.unit_circle()
310 # concatenate the star with an internal cutout of the circle
311 verts = np.concatenate([circle.vertices, star.vertices[::-1]])
312 codes = np.concatenate([circle.codes, star.codes])
313 cut_star1 = mpath.Path(verts, codes)
314 cut_star2 = mpath.Path(verts + 1, codes)
315
316 ax = plt.axes()
317 col = mcollections.PathCollection([cut_star2],
318 linewidth=5, linestyles='dashdot',
319 alpha=0.25,
320 facecolor=(1, 0, 0, 0.5),
321 edgecolor=(0, 0, 1, 0.75))
322 ax.add_collection(col)
323
324 patch = mpatches.PathPatch(cut_star1,
325 linewidth=5, linestyle='dashdot',
326 alpha=0.25,
327 facecolor=(1, 0, 0, 0.5),
328 edgecolor=(0, 0, 1, 0.75))
329 ax.add_patch(patch)
330
331 ax.set_xlim(-1, 2)
332 ax.set_ylim(-1, 2)
333
334
335@mpl.style.context('default')

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…