|
27 | 27 | import matplotlib.pyplot as plt |
28 | 28 | import matplotlib.markers as mmarkers |
29 | 29 | import matplotlib.patches as mpatches |
| 30 | +import matplotlib.colors as mcolors |
30 | 31 | from numpy.testing import assert_allclose, assert_array_equal |
31 | 32 | from matplotlib.cbook import IgnoredKeywordWarning |
32 | 33 | import matplotlib.colors as mcolors |
@@ -4613,6 +4614,34 @@ def test_bar_color_cycle(): |
4613 | 4614 | assert ccov(ln.get_color()) == ccov(br.get_facecolor()) |
4614 | 4615 |
|
4615 | 4616 |
|
| 4617 | +@cleanup(style='default') |
| 4618 | +def test_fillbetween_cycle(): |
| 4619 | + fig, ax = plt.subplots() |
| 4620 | + |
| 4621 | + for j in range(3): |
| 4622 | + cc = ax.fill_between(range(3), range(3)) |
| 4623 | + target = mcolors.to_rgba('C{}'.format(j)) |
| 4624 | + assert tuple(cc.get_facecolors().squeeze()) == tuple(target) |
| 4625 | + |
| 4626 | + for j in range(3, 6): |
| 4627 | + cc = ax.fill_betweenx(range(3), range(3)) |
| 4628 | + target = mcolors.to_rgba('C{}'.format(j)) |
| 4629 | + assert tuple(cc.get_facecolors().squeeze()) == tuple(target) |
| 4630 | + |
| 4631 | + target = mcolors.to_rgba('k') |
| 4632 | + |
| 4633 | + for al in ['facecolor', 'facecolors', 'color']: |
| 4634 | + cc = ax.fill_between(range(3), range(3), **{al: 'k'}) |
| 4635 | + assert tuple(cc.get_facecolors().squeeze()) == tuple(target) |
| 4636 | + |
| 4637 | + edge_target = mcolors.to_rgba('k') |
| 4638 | + for j, el in enumerate(['edgecolor', 'edgecolors'], start=6): |
| 4639 | + cc = ax.fill_between(range(3), range(3), **{el: 'k'}) |
| 4640 | + face_target = mcolors.to_rgba('C{}'.format(j)) |
| 4641 | + assert tuple(cc.get_facecolors().squeeze()) == tuple(face_target) |
| 4642 | + assert tuple(cc.get_edgecolors().squeeze()) == tuple(edge_target) |
| 4643 | + |
| 4644 | + |
4616 | 4645 | if __name__ == '__main__': |
4617 | 4646 | import nose |
4618 | 4647 | import sys |
|
0 commit comments