Skip to content

Backport PR #9353 on branch v2.1.x #9364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2108,9 +2108,10 @@ def bar(self, *args, **kwargs):
if edgecolor is None:
edgecolor = itertools.repeat(None)
else:
edgecolor = itertools.chain(mcolors.to_rgba_array(edgecolor),
# Fallback if edgecolor == "none".
itertools.repeat([0, 0, 0, 0]))
edgecolor = itertools.chain(
itertools.cycle(mcolors.to_rgba_array(edgecolor)),
# Fallback if edgecolor == "none".
itertools.repeat([0, 0, 0, 0]))

# lets do some conversions now since some types cannot be
# subtracted uniformly
Expand Down
9 changes: 6 additions & 3 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5260,12 +5260,15 @@ def test_eventplot_legend():
plt.legend()


def test_bar_single_height():
def test_bar_broadcast_args():
fig, ax = plt.subplots()
# Check that a bar chart with a single height for all bars works
# Check that a bar chart with a single height for all bars works.
ax.bar(range(4), 1)
# Check that a horizontal chart with one width works
# Check that a horizontal chart with one width works.
ax.bar(0, 1, bottom=range(4), width=1, orientation='horizontal')
# Check that edgecolor gets broadcasted.
rect1, rect2 = ax.bar([0, 1], [0, 1], edgecolor=(.1, .2, .3, .4))
assert rect1.get_edgecolor() == rect2.get_edgecolor() == (.1, .2, .3, .4)


def test_invalid_axis_limits():
Expand Down