Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ENH]: Suppress duplicate labels in legend #23664

Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
@story645

Description

@story645
Issue body actions

Problem

As discussed in #23525, the legend treats every label as distinct and will therefore display them even when visually indistinguishable.
image

Proposed solution

@timhoffm raised the good point that we don't want to break the artist-(label, handle) link in case the artist gets updated, so I think an alternative solution is maybe to have this logic in the legend. Something like a duplicate keyword argument to legend:

  • duplicate=True, default, current behavior
  • duplicate=False - triggers a check of legend objects. If multiple legend handles have the same properties (class, color/edgecolor, hatch, size/width/edgewidth, etc) and the same label, then a new handle with those properties linked to all the artists is shown in place of the original handles.

I'm not sure if this is even doable in the current architecture, but if possible this would be designed so that updates to properties that update handles/legends propagate back to create new entries on the legend as needed. The advantage of this approach is that it would facilitate explicitly linking legend labels & handles to multiple artists.

I think currently duplicates are eliminated manually either by omitting the labels on some artists or creating a custom legend handle. Neither approach preserves a link between a legend entry and all the artists it is intended to describe.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.