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
Legend for entries in boxplot are displayed as thin lines as opposed to patches
When we have multiple box plots in the same axis, legend shows thin lines as opposed to boxes and it is difficult to tell entries apart. This issue has been documented at this link with a reproducible example.
I think this is mostly a matter of setting label="_nolegend_" on all artists generated by boxplot except the box itself (the black lines in the SO example come from the fact that we currently try to generate legend entries for the whiskers, caps, and outliers).
Even better would be to have a custom handler for boxplots, but that seems to be much more work.
Activity
story645 commentedon Jun 25, 2021
Do you think the legend should use boxes as illustrated in the answer to that question?
RSKothari commentedon Jun 25, 2021
@story645 Yes, I think that should be the default behavior of legend when used on
boxplot.anntzer commentedon Jun 25, 2021
I think this is mostly a matter of setting
label="_nolegend_"on all artists generated by boxplot except the box itself (the black lines in the SO example come from the fact that we currently try to generate legend entries for the whiskers, caps, and outliers).Even better would be to have a custom handler for boxplots, but that seems to be much more work.
saranti commentedon Jun 14, 2023
Ever since v3.5, the first entry in the legend is shown as a rectangular patch with the rest shown as lines:
It's the same regardless of the number of entries.
story645 commentedon Jun 14, 2023
code to reproduce:
ET2: I haven't done a bisect, but #20515 went in around 3.5 and refactored the boxplot code.
Partly revert matplotlib#27711
Partly revert matplotlib#27711
Partly revert matplotlib#27711
Partly revert matplotlib#27711
Partly revert matplotlib#27711