8000 Modified scatter method to correctly recognize RGB/A values by vecuenca · Pull Request #6087 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Modified scatter method to correctly recognize RGB/A values #6087

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

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modified scatter method to correctly recognize RGB/A values
  • Loading branch information
vecuenca committed Mar 1, 2016
commit dcf8f6e91e8c0c5403aa436824666fac56fb50c1
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3861,7 +3861,7 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
# favor of mapping, not rgb or rgba.
try:
c_array = np.asanyarray(c, dtype=float)
if c_array.size == x.size:
if c_array.size == x.size and c_array.shape[0] != 1:
Copy link
Member

Choose a reason for hiding this comment

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

Is there anyway we can get a numpy-scaler in here as a valid input? If so probably want to be a bit more paranoid and add and carray.ndims

Copy link
Member

Choose a reason for hiding this comment

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

and would the check on c_array.ndim == 1 be a better check?

c = np.ma.ravel(c_array)
else:
# Wrong size; it must not be intended for mapping.
Expand Down
0