8000 STY: make default legend edgecolor gray by efiring · Pull Request #6770 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 4 commits into from
Jul 25, 2016

Conversation

efiring
Copy link
Member
@efiring efiring commented Jul 17, 2016

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.

@efiring
Copy link
Member Author
efiring commented Jul 17, 2016

Here is the example from #6685 with this PR:
gray_legend_boundary

if rcParams["legend.edgecolor"] == 'inherit':
edgecolor = rcParams["axes.edgecolor"]
else:
if edgcolor is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edgecolor (typo)

@anntzer
Copy link
Contributor
anntzer commented Jul 17, 2016

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).

@tacaswell tacaswell added this to the 2.0 (style change major release) milestone Jul 17, 2016
@@ -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
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@efiring
Copy link
Member Author
efiring commented Jul 17, 2016

Here's an example of the PR with the legend overlying part of the plot content. The effect of the PR is only to add the gray boundary.
sinusoids_with_legend

@efiring
Copy link
Member Author
efiring commented Jul 17, 2016

This is our examples/lines_bars_and_markers/scatter_with_legend.py result with this PR.
scatter_with_legend

@QuLogic
Copy link
Member
QuLogic commented Jul 17, 2016

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.

@tacaswell tacaswell merged commit 5598853 into matplotlib:v2.x Jul 25, 2016
@QuLogic QuLogic mentioned this pull request Aug 30, 2016
@efiring efiring deleted the legend_boundary branch October 24, 2021 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0