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

Conversation

vecuenca
Copy link
Contributor

@vecuenca vecuenca commented Mar 1, 2016

This is a fix for #5377.

After being converted to a ndarray, the scatter method does not check if c_array is a 2D array (i.e. if we are passing RGB or RGB/A values.

@@ -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?

@tacaswell tacaswell added this to the 1.5.2 (Critical bug fix release) milestone Mar 2, 2016
@vecuenca
Copy link
Contributor Author

Yes, I think you are right. I hadn't noticed the existence of ndim previously.

@tacaswell
Copy link
Member

Can you please rebase onto current master (or at least current v2.x)?

Merging upstream branches into feature branches causes problems, please do not do it.

@mdboom
Copy link
Member

mdboom commented May 16, 2016

Closing this. There doesn't seem to be a good way to resolve this ambiguity, and it's already been discussed and notated in the comment in the code where this change is.

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.

5 participants