Skip to content

Commit 8a69c67

Browse files
committed
legend colors initialization moved to save.py
1 parent da7f946 commit 8a69c67

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

matplotlib2tikz/legend.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,14 @@ def draw_legend(data, obj):
200200
)
201201

202202
# Set color of lines in legend
203-
data['legend colors'] = []
204203
for handle in obj.legendHandles:
205204
try:
206205
data, legend_color, _ = mycol.mpl_color2xcolor(data,
207206
handle.get_color())
208207
data['legend colors'].append('\\addlegendimage{no markers, %s}\n'
209208
% legend_color)
210209
except AttributeError:
211-
data['legend colors'] = []
210+
pass
212211

213212
# Write styles to data
214213
if legend_style:

matplotlib2tikz/save.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def get_tikz_code(
124124
data['pgfplots libs'] = set()
125125
data['font size'] = textsize
126126
data['custom colors'] = {}
127+
data['legend colors'] = []
127128
data['extra tikzpicture parameters'] = extra_tikzpicture_parameters
128129
# rectangle_legends is used to keep track of which rectangles have already
129130
# had \addlegendimage added. There should be only one \addlegenimage per

0 commit comments

Comments
 (0)