Skip to content

Commit 7ff9287

Browse files
committed
Fix edgecolor being only applied to first bar.
1 parent ad730d1 commit 7ff9287

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,9 +2108,10 @@ def bar(self, *args, **kwargs):
21082108
if edgecolor is None:
21092109
edgecolor = itertools.repeat(None)
21102110
else:
2111-
edgecolor = itertools.chain(mcolors.to_rgba_array(edgecolor),
2112-
# Fallback if edgecolor == "none".
2113-
itertools.repeat([0, 0, 0, 0]))
2111+
edgecolor = itertools.chain(
2112+
itertools.cycle(mcolors.to_rgba_array(edgecolor)),
2113+
# Fallback if edgecolor == "none".
2114+
itertools.repeat([0, 0, 0, 0]))
21142115

21152116
# lets do some conversions now since some types cannot be
21162117
# subtracted uniformly

lib/matplotlib/tests/test_axes.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5260,12 +5260,15 @@ def test_eventplot_legend():
52605260
plt.legend()
52615261

52625262

5263-
def test_bar_single_height():
5263+
def test_bar_broadcast_args():
52645264
fig, ax = plt.subplots()
5265-
# Check that a bar chart with a single height for all bars works
5265+
# Check that a bar chart with a single height for all bars works.
52665266
ax.bar(range(4), 1)
5267-
# Check that a horizontal chart with one width works
5267+
# Check that a horizontal chart with one width works.
52685268
ax.bar(0, 1, bottom=range(4), width=1, orientation='horizontal')
5269+
# Check that edgecolor gets broadcasted.
5270+
rect1, rect2 = ax.bar([0, 1], [0, 1], edgecolor=(.1, .2, .3, .4))
5271+
assert rect1.get_edgecolor() == rect2.get_edgecolor() == (.1, .2, .3, .4)
52695272

52705273

52715274
def test_invalid_axis_limits():

0 commit comments

Comments
 (0)