We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5b4798 commit b242628Copy full SHA for b242628
matplotlib2tikz/line2d.py
@@ -3,6 +3,17 @@
3
from . import color as mycol
4
from . import path as mypath
5
6
+def get_legend_label_(line):
7
+ '''Check if line is in legend
8
+ '''
9
+
10
+ label = line.get_label()
11
+ try:
12
+ ax = line.axes
13
+ leg = ax.get_legend()
14
+ return label in [l.get_label() for l in leg.get_lines()]
15
+ except:
16
+ return None
17
18
def draw_line2d(data, obj):
19
'''Returns the PGFPlots code for an Line2D environment.
@@ -92,7 +103,7 @@ def draw_line2d(data, obj):
92
103
93
104
# Check if a line is not in a legend and forget it if so,
94
105
# fixes bug #167:
95
- if obj.get_label().startswith("_line"):
106
+ if not get_legend_label_(obj):
96
107
addplot_options.append("forget plot")
97
108
98
109
# process options
0 commit comments