| 5514 | |
| 5515 | |
| 5516 | def 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, |