Thanks to visit codestin.com
Credit goes to github.com

Skip to content

In scatter, fix single rgb edgecolors handling #19539

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 1 commit into from
Feb 19, 2021

Conversation

efiring
Copy link
Member

@efiring efiring commented Feb 18, 2021

Closes #19066.

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [N/A ] New features are documented, with examples if plot related.
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@tacaswell tacaswell added this to the v3.4.0 milestone Feb 18, 2021
@@ -4507,6 +4507,11 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
x, y, s, c, colors, edgecolors, linewidths = \
cbook._combine_masks(
x, y, s, c, colors, edgecolors, linewidths)
# Unmask edgecolors if it was actually a single RGB or RGBA.
if (x.size in (3, 4)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a similar block for colors as well?

Copy link
Member

Choose a reason for hiding this comment

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

I believe that is already an (N,4) array out of _parse_scatter_color_args and should have broadcast correctly with the masks.

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, because the case that was problematic for colors was the case where edgecolors was being
set from colors, above all this. So handling edgecolors here takes care of it.

@QuLogic QuLogic merged commit 9a242b2 into matplotlib:master Feb 19, 2021
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.

plt.scatter, error with NaN values and edge color
3 participants