You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I am a bit preplexed by this. It looks like the patch attached to the legend is a FancyBboxPatch which uses the set_facecolor method from Patch. The color is rgba-ified using colors.colorConverter.to_rgba(arg, self._alpha) which will ignore the alpha value passed in (the observed issue). However, looking at the blame for both of those functions, the only changes between 1.3.1 and 1.4 are from #3092 which should not have affected this.
853c26a
calls set_alpha() on the patch; once that is set, set_facecolor uses it to override the "a" in "rgba".
In other words, adding an rcParam changed _alpha of None to a default value; and once that is done, you are stuck with it until you explicitly change it! The painful saga of alpha-handling continues...
As a matter of style, the relevant bit of code in legend:
Activity
tacaswell commentedon Nov 9, 2014
I am a bit preplexed by this. It looks like the patch attached to the legend is a
FancyBboxPatchwhich uses theset_facecolormethod fromPatch. The color is rgba-ified usingcolors.colorConverter.to_rgba(arg, self._alpha)which will ignore the alpha value passed in (the observed issue). However, looking at the blame for both of those functions, the only changes between 1.3.1 and 1.4 are from #3092 which should not have affected this.efiring commentedon Nov 9, 2014
853c26a
calls set_alpha() on the patch; once that is set, set_facecolor uses it to override the "a" in "rgba".
In other words, adding an rcParam changed _alpha of None to a default value; and once that is done, you are stuck with it until you explicitly change it! The painful saga of alpha-handling continues...
As a matter of style, the relevant bit of code in legend:
is obfuscated by the use of the get_frame() method; what it gets is the
legendPatchthat was created in the same method a few lines above.mrclary commentedon Nov 9, 2014
I've confirmed that the behavior exhibits after version 1.4.0 (1.3.1 and 1.4.0 are okay, >=1.4.1 not okay)
tacaswell commentedon Nov 9, 2014
I have a fix for this, just need to add some tests.
BUG : correct default value alpha on legend patch