You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last example in the example notebook is not reproducing what is shown in the repository. The labels on the dashed lines are incorrect. There is a mismatch between the lines and the label shown on the lines when specifying the lines parameter in labelLines.
Image produced when I run the example:
It appears this problem is a result of using the labels from the all_labels variable from the ax.get_legend_handles_labels() call on line 130. The for loop at line 199 in core.py assumes that all_labels and all_lines have the same ordering, which may not always be true if the lines parameter is specified.
It looks like the example notebook hasn't been updated in 3 years, so I presume some change to core.py in the meantime has resulted in this issue.
Tentative solution
I was able to fix this by ignoring the all_labels variable and reading the label directly from the line object when iterating through all_lines. This can be done by changing line 200 to the following: label = line.get_label().
However, perhaps there is a reason this is not already the default. I did not test this with every line object in matplotlib, so there could be some objects in matplotlib that do not support the get_label method.
Thanks
Despite this issue, this is a nice package.
I appreciate the work put into it, and I plan on using it :)
The text was updated successfully, but these errors were encountered:
Problem
The last example in the example notebook is not reproducing what is shown in the repository. The labels on the dashed lines are incorrect. There is a mismatch between the lines and the label shown on the lines when specifying the
lines
parameter inlabelLines
.Image produced when I run the example:
It appears this problem is a result of using the labels from the
all_labels
variable from theax.get_legend_handles_labels()
call on line 130. The for loop at line 199 incore.py
assumes thatall_labels
andall_lines
have the same ordering, which may not always be true if thelines
parameter is specified.It looks like the example notebook hasn't been updated in 3 years, so I presume some change to
core.py
in the meantime has resulted in this issue.Tentative solution
I was able to fix this by ignoring the
all_labels
variable and reading the label directly from the line object when iterating throughall_lines
. This can be done by changing line 200 to the following:label = line.get_label()
.However, perhaps there is a reason this is not already the default. I did not test this with every line object in matplotlib, so there could be some objects in matplotlib that do not support the
get_label
method.Thanks
Despite this issue, this is a nice package.
I appreciate the work put into it, and I plan on using it :)
The text was updated successfully, but these errors were encountered: