-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
STY: make default legend edgecolor gray #6770
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
Conversation
Here is the example from #6685 with this PR: |
if rcParams["legend.edgecolor"] == 'inherit': | ||
edgecolor = rcParams["axes.edgecolor"] | ||
else: | ||
if edgcolor is None: |
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.
edgecolor
(typo)
Maybe worth having an example (for the PR at least) that shows how this looks like when the legend does overlap with some markers (it is partially transparent). |
@@ -180,6 +180,8 @@ def __init__(self, parent, handles, labels, | |||
title=None, # set a title for the legend | |||
|
|||
framealpha=None, # set frame alpha | |||
edgecolor=None, # frame patch edgecolor |
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.
Can you put these at the end?
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.
Why? They are all documented as kwargs, not positional arguments, and in the documentation their order differs from their originally random order in the signature.
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.
because they can be passed in as positional.
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.
No, they cannot. Axes.legend
has no mechanism for doing so. Furthermore, even if there were such a mechanism, it would cause endless confusion because the order in which the kwargs are documented did not correspond to their order in the signature even before my PR.
The real bug in the present PR is that I added the new kwargs to the class docstring but not to the Axes method docstring. I will rectify that now.
Looks reasonable. The background patch covers the case of a dense underlying artists, and the frame is light enough to be unobtrusive but still work with sparse underlying artists. |
Closes #6685.
In addition to the rcParams change I added legend kwargs for edgecolor and facecolor and made slight docstring improvements, but much more could be done to improve the legend docstring.