8000 Naive fix for issue 8193 · matplotlib/matplotlib@06b7ccc · GitHub
[go: up one dir, main page]

Skip to content

Commit 06b7ccc

Browse files
committed
Naive fix for issue 8193
1 parent 6030485 commit 06b7ccc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,15 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
11931193
lineoffsets = [None]
11941194
if len(colors) == 0:
11951195
colors = [None]
1196+
try:
1197+
# Early conversion of the colors into RGBA values to take care
1198+
# of cases like colors='0.5' or colors='C1'. (Issue #8193)
1199+
colors = mcolors.to_rgba_array(colors)
1200+
except ValueError:
1201+
# Will fail if any element of *colors* is None. But as long
1202+
# as len(colors) == 1 or len(positions), the rest of the
1203+
# code should process *colors* properly.
1204+
pass
11961205

11971206
if len(lineoffsets) == 1 and len(positions) != 1:
11981207
lineoffsets = np.tile(lineoffsets, len(positions))

0 commit comments

Comments
 (0)
0