Skip to content

Commit 8a38582

Browse files
author
Tino Michael
committed
catching error during messy RGBA colour handling
1 parent 66da89d commit 8a38582

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

matplotlib2tikz/legend.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,12 @@ def draw_legend(data, obj):
202202
# Set color of lines in legend
203203
for handle in obj.legendHandles:
204204
try:
205-
data, legend_color, _ = mycol.mpl_color2xcolor(data,
206-
handle.get_color())
205+
try:
206+
data, legend_color, _ = mycol.mpl_color2xcolor(
207+
data, handle.get_color())
208+
except ValueError:
209+
data, legend_color, _ = mycol.mpl_color2xcolor(
210+
data, numpy.squeeze(numpy.array(handle.get_color())))
207211
data['legend colors'].append('\\addlegendimage{no markers, %s}\n'
208212
% legend_color)
209213
except AttributeError:

0 commit comments

Comments
 (0)