Skip to content

Feature Request: Artists should have a name attribute? #3033

Closed
@JamesRamm

Description

@JamesRamm

It would be great if plotting methods accepted a name argument which would set a name attribute in the relevant artists. This would make GUI development with embedded matplotlib plots much easier.

In interactive applications we may create any number of plots within an axes - keeping track of them can be a problem. The label attribute is no good as this is used by legends, so needs to support 'nolegend' labels...

A name attribute would provide a mechanism by which to display a reference to a plot/data to the user and allow an artist object to be retrieved via its name.

A potential problem would be having artists of the same name. A solution could be to enforce unique names for each artist within an axes, or unique names for each artist type within an axes...
I think the second method would be preferred as this would allow different artist types to be grouped under the same name. There are many times where I encounter a situation where I plot some data (as e.g. Line2D) and plot related data (such as the standard deviation...as e.g. a polycollection via fill_between), but would like to treat these as one, or related objects for operations such as removing a plot from the axes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions