8000 FIX: eventplot 'colors' kwarg (#8193) by afvincent · Pull Request #8204 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: eventplot 'colors' kwarg (#8193) #8204

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

Closed
Closed
Changes from 1 commit
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
Next Next commit
Naive fix for issue 8193
  • Loading branch information
afvincent committed Mar 20, 2017
commit e4fe2393d40d46e98a9fb40c3227e7a72021da63
9 changes: 9 additions & 0 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,15 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
lineoffsets = [None]
if len(colors) == 0:
colors = [None]
try:
# Early conversion of the colors into RGBA values to take care
# of cases like colors='0.5' or colors='C1'. (Issue #8193)
colors = mcolors.to_rgba_array(colors)
except ValueError:
# Will fail if any element of *colors* is None. But as long
# as len(colors) == 1 or len(positions), the rest of the
# code should process *colors* properly.
pass

if len(lineoffsets) == 1 and len(positions) != 1:
lineoffsets = np.tile(lineoffsets, len(positions))
Expand Down
0