[MNT]: Remove the label API from Artist · Issue #29422 · matplotlib/matplotlib · GitHub
Skip to content

[MNT]: Remove the label API from Artist #29422

Description

@timhoffm

Summary

Artist provides the label API intended to for legend labels:

image

However, only a small subset of Artists are "data" Artists and can be reasonably used in a legend. From the subclasses of Artist:

  • suitable for legend: Line2D, Collection, Patch
  • not suitable for legend: AnnotationBbox, Text, Tick, Axis, FigureBase, Legend, _AxesBase, Table, OffsetBox, _ImageBase, QuiverKey

In some of these not-suitable classes label is repurposed for other use cases, e.g. axis labels, figure labels being displayed as window title. That's quite confusing.

Proposed fix

Create a Protocol or Mixin or DataArtist subclass for legend labels and use that in Line2D, Collection, Patch. Deprecate and remove get/set_label from all other Artists; possibly taking special measures where label is currently repurposed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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