Skip to content

Adding rcParams[‘scatter.edgecolors’] defaulting to ‘face’ #12992

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
Dec 24, 2018

Conversation

bsipocz
Copy link
Contributor

@bsipocz bsipocz commented Dec 14, 2018

PR Summary

This PR attempts to add scatter.edgecolors to the rcParams as per a recent discussion on gitter.

I would like to set edgecolors for scatter plots centrally so my plots will be more consistent without adding the kwarg to each of them (the original plots relied on the old style having a default edgecolor that is different from facecolor).
I couldn't find an rcParam that set it and was suggested to use _internal.classic_mode as a workaround.

I haven't yet figured out where the default list is generated for testing, and thought it better ask for help there. Also, please advise whether this needs more docs beyond the change in the docstring. Also, if needed, I can go though the other functions to find use cases for the new rcParam, e.g. I suppose hexbin could also use it.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@timhoffm
Copy link
Member

Thanks for the PR. This issue was also brought up in #11933.

I'm not quite sure if we want extra rcParams for every plot type. But you are right, as of now it's possible to influence the edgecolor of the markers with rcParams.

It's all a bit of a mess, e.g. linewidths defaults to rcParams['lines.linewidth']. If that would have been rcParams['lines.markeredgewidth'] instead, I would have said that egdecolors should just use rcParams['lines.markeredgecolor']. But due to the asymmetry it's probably better to make a clear cut and allow for rcParams['scatter.edgecolors'].

Please update the file matplotlibrc.template as well. This is causing the test failures.

@@ -4247,13 +4247,16 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
is 'face'. You may want to change this as well.
If *None*, defaults to rcParams ``lines.linewidth``.

edgecolors : color or sequence of color, optional, default: 'face'
edgecolors : {'face', 'none', *None*} or color, optional
Copy link
Member

Choose a reason for hiding this comment

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

please also leave the "sequence of colors" in. You can do:

plt.scatter([0, 1, 2], [1, 3, 2], s=400, marker='o', edgecolors=['c', 'm', 'y'])

Copy link
Contributor Author

@bsipocz bsipocz Dec 17, 2018

Choose a reason for hiding this comment

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

I had issues with the line width here, not sure how nicely the new version would render in the API docs summary.

@tacaswell tacaswell added this to the v3.1 milestone Dec 17, 2018
@tacaswell tacaswell added Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. and removed Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labels Dec 17, 2018
@@ -4247,12 +4247,16 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
is 'face'. You may want to change this as well.
If *None*, defaults to rcParams ``lines.linewidth``.

edgecolors : color or sequence of color, optional, default: 'face'
edgecolors : {'face', 'none', *None*} or color or sequence of color,
optional.
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work because the definition has to be on a logical line.

https://16774-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/api/_as_gen/matplotlib.axes.Axes.scatter.html#matplotlib.axes.Axes.scatter

Use a line continuation

         edgecolors : {'face', 'none', *None*} or color or sequence of color, \
                 optional
             The edge color of the marker. Possible values:

@bsipocz bsipocz force-pushed the rcParams_scatter.edgecolors branch from ced69df to fbc7cbd Compare December 17, 2018 20:50
Co-Authored-By: bsipocz <b.sipocz@gmail.com>
@timhoffm timhoffm merged commit 11def88 into matplotlib:master Dec 24, 2018
@timhoffm
Copy link
Member

Thanks and congratulations on your first contribution to matplotlib! Hope to see you back some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants