Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Expose legend's line: legline._legmarker as public #20552

Closed
@ianhi

Description

@ianhi

Problem

I would like to be able to modify the alpha of both the line and marker in a legend as an extension of this example: https://matplotlib.org/stable/gallery/event_handling/legend_picking.html

However, currently the only way to access the marker in in the legend in order to set it's alpha value is via the private legline._legmarker attribute.

legline._legmarker = legline_marker

This is not ideal for the reasons that @jklymak noted in #9155 (comment)

This is pretty hacky, and the undrscore means it could go away.

So with the current public api the best you can achieve is:
image

when what I want is:
image

Proposed Solution

The simplest solution would be to drop the underscore on the legmarker and add modifying the marker to the example as a way of documenting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueOpen a pull request against these issues if there are no active ones!New feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions