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
{{ message }}
Repository navigation
Only one legend entry is rendered for items with the same label and color #10056
Only one legend entry is rendered for items with the same label and color
In Matplotlib 2.1.1, items that have the same label and color result in a single legend entry. This happens even if some other properties of the items are different (eg. marker or linewidth).
This behaviour is surprising because the style of the first item is used for the handle, regardless of the style of the following items.
I would expect either the behaviour from Matplotlib 2.1.0, or the labels being merged only if the label and all style properties are equal.
OK, I see what has happened finally. Sorry to be so slow.
The de-duplication logic was only in Figure.legendnot in Axes.legend (or pyplot.legend()).
The old Figure.legend de-duplication had this bug and the bug reported in #10030.
What I did in #9324 was make the parsing logic the same. So the de-duplciation logic ended up in Axes.legend and that means people who weren't triggering the bug now are triggering the bug.
I propose we get rid of the de-duplciation logic for both versions of legend. That is a breaking API change for Figure.legend() but I think it is a pretty clear edge case. I think its better to do that than to keep the de-duplication logic for Axes.legend() which was also a breaking change that we (I) didn't note at the time.
@HappyMeeple the original report example works fine for me, so if you have a similar error, please open a new issue with a self-contained minimal example. Thanks!
Activity
tacaswell commentedon Dec 20, 2017
attn @jklymak Looks like more issues with the de-duplication logic.
jklymak commentedon Dec 20, 2017
OK, I see what has happened finally. Sorry to be so slow.
The de-duplication logic was only in
Figure.legendnot inAxes.legend(orpyplot.legend()).The old
Figure.legendde-duplication had this bug and the bug reported in #10030.What I did in #9324 was make the parsing logic the same. So the de-duplciation logic ended up in
Axes.legendand that means people who weren't triggering the bug now are triggering the bug.I propose we get rid of the de-duplciation logic for both versions of legend. That is a breaking API change for
Figure.legend()but I think it is a pretty clear edge case. I think its better to do that than to keep the de-duplication logic forAxes.legend()which was also a breaking change that we (I) didn't note at the time.jklymak commentedon Dec 21, 2017
Closed #10064. Thanks for the bug report!
HappyMeeple commentedon Nov 28, 2021
I experience the same bug, or so I think with Matplotlib 3.4.3.
However, it should be fixed, right?
jklymak commentedon Nov 29, 2021
@HappyMeeple the original report example works fine for me, so if you have a similar error, please open a new issue with a self-contained minimal example. Thanks!