diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index a0cb6613ce33..b091cad4291f 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1999,14 +1999,14 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", linewidth = itertools.cycle(np.atleast_1d(linewidth)) color = itertools.chain(itertools.cycle(mcolors.to_rgba_array(color)), # Fallback if color == "none". - itertools.repeat([0, 0, 0, 0])) + itertools.repeat('none')) if edgecolor is None: edgecolor = itertools.repeat(None) else: edgecolor = itertools.chain( itertools.cycle(mcolors.to_rgba_array(edgecolor)), # Fallback if edgecolor == "none". - itertools.repeat([0, 0, 0, 0])) + itertools.repeat('none')) # We will now resolve the alignment and really have # left, bottom, width, height vectors diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 12197bd8e55f..778b75791dd9 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1456,6 +1456,22 @@ def test_bar_tick_label_multiple_old_alignment(): align='center') +def test_bar_color_none_alpha(): + ax = plt.gca() + rects = ax.bar([1, 2], [2, 4], alpha=0.3, color='none', edgecolor='r') + for rect in rects: + assert rect.get_facecolor() == (0, 0, 0, 0) + assert rect.get_edgecolor() == (1, 0, 0, 0.3) + + +def test_bar_edgecolor_none_alpha(): + ax = plt.gca() + rects = ax.bar([1, 2], [2, 4], alpha=0.3, color='r', edgecolor='none') + for rect in rects: + assert rect.get_facecolor() == (1, 0, 0, 0.3) + assert rect.get_edgecolor() == (0, 0, 0, 0) + + @image_comparison(baseline_images=['barh_tick_label'], extensions=['png']) def test_barh_tick_label():