Skip to content

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

Closed
vecuenca wants to merge 16 commits into
matplotlib:masterfrom
vecuenca:v2.x
Closed

vecuenca wants to merge 16 commits into
matplotlib:masterfrom
vecuenca:v2.x

Conversation

@vecuenca

@vecuenca vecuenca commented Mar 1, 2016

Copy link
Copy Markdown
Contributor

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.

Comment thread lib/matplotlib/axes/_axes.py Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@tacaswell

Copy link
Copy Markdown
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

mdboom commented May 16, 2016

Copy link
Copy Markdown
Member

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