-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
If Legend shadow=True set framealpha=1 if not passed explicitly instead of consulting rcParams #8988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If Legend shadow=True set framealpha=1 if not passed explicitly instead of consulting rcParams #8988
Changes from 3 commits
04ef849
0808634
538da87
a030a8d
569c4f5
755d9c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,8 +384,13 @@ def __init__(self, parent, handles, labels, | |
# init with null renderer | ||
self._init_legend_box(handles, labels, markerfirst) | ||
|
||
# If shadow is activated use framealpha if not | ||
# explicitly passed. See Issue 8943 | ||
if framealpha is None: | ||
self.get_frame().set_alpha(rcParams["legend.framealpha"]) | ||
if shadow is True: | ||
self.framealpha = 1 | ||
else: | ||
self.get_frame().set_alpha(rcParams["legend.framealpha"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are there two ways of setting framealpha? I would stick with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright will change both lines as proposed. |
||
else: | ||
self.get_frame().set_alpha(framealpha) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is perfect here! Can you also add a note about this to the docstring at https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L298 ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always glad to help. 👍
I would put it into the doc of framealpha:
matplotlib/lib/matplotlib/axes/_axes.py
Line 427 in 5a24121
to make clear that if shadow is activated and framealpha is
None
it will set the value to be 1 instead of taking it fromlegend.framealpha
:data:rcParam<matplotlib.rcParams>
.Should I also add something to
matplotlib/lib/matplotlib/axes/_axes.py
Line 422 in 5a24121
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To both? The goal is to make sure users are not confused / can un-confuse them selves easily. Putting it in
shadow
warns someone using it that it might affect other parts and someone who is having issues with the defaultframalpha
being ignored might go check it's docstring.