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

Function test_eventplot_alpha

lib/matplotlib/tests/test_axes.py:5516–5533  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5514
5515
5516def test_eventplot_alpha():
5517 fig, ax = plt.subplots()
5518
5519 # one alpha for all
5520 collections = ax.eventplot([[0, 2, 4], [1, 3, 5, 7]], alpha=0.7)
5521 assert collections[0].get_alpha() == 0.7
5522 assert collections[1].get_alpha() == 0.7
5523
5524 # one alpha per collection
5525 collections = ax.eventplot([[0, 2, 4], [1, 3, 5, 7]], alpha=[0.5, 0.7])
5526 assert collections[0].get_alpha() == 0.5
5527 assert collections[1].get_alpha() == 0.7
5528
5529 with pytest.raises(ValueError, match="alpha and positions are unequal"):
5530 ax.eventplot([[0, 2, 4], [1, 3, 5, 7]], alpha=[0.5, 0.7, 0.9])
5531
5532 with pytest.raises(ValueError, match="alpha and positions are unequal"):
5533 ax.eventplot([0, 2, 4], alpha=[0.5, 0.7])
5534
5535
5536@image_comparison(['test_eventplot_problem_kwargs.png'], remove_text=True,

Callers

nothing calls this directly

Calls 3

eventplotMethod · 0.80
subplotsMethod · 0.45
get_alphaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…