Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 03fd172

Browse filesBrowse files
dstansbyMeeseeksDev[bot]
authored andcommitted
Backport PR #9353: Fix edgecolor being only applied to first bar.
1 parent cc090bb commit 03fd172
Copy full SHA for 03fd172

File tree

Expand file treeCollapse file tree

2 files changed

+10
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-6
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+4-3Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+6-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.