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

Skip to content

Transparency not respected in legendPatch #3766

Closed
@mrclary

Description

@mrclary

It seems after Matplotlib 1.3.1 (1.4.1, 1.4.2, not sure about 1.4.0) that setting the transparency of the facecolor or edgecolor properties of a legendPatch is not respected. Both properties can be changed together using legendPatch.set_alpha(...), but they cannot be set independently. Following is a MWE. Here, the legend's facecolor is changed, but the alpha specification (0.2) is ignored. A call to legendPatch.get_facecolor() confirms this.

import matplotlib.pyplot as plt

plt.plot(range(10))
leg = plt.legend(['Line'])
leg.legendPatch.set_facecolor([0.5,1,0.5,0.2])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions