Skip to content
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

Fixes #9148: Use tuples for color specification #9149

Merged
merged 1 commit into from Jun 18, 2017

Conversation

Projects
None yet
3 participants
@gusennan
Copy link
Contributor

gusennan commented Jun 17, 2017

This PR fixes the issue specified in #9148.

In the Matplotlib 'Specifying Colors' section, an array is not a valid color specification type. When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message:

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting the arrays to tuples for the matplotlib color specification.

Use tuples for color specification
In the Matplotlib 'Specifying Colors' section, a list is not a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting the lists to tuples for the matplotlib color specification.

@jnothman jnothman added this to the 0.19 milestone Jun 17, 2017

@jnothman

This comment has been minimized.

Copy link
Member

jnothman commented Jun 17, 2017

From the code it looks like the colours were previously arrays, not lists. Am I reading wrong?

@gusennan

This comment has been minimized.

Copy link
Contributor Author

gusennan commented Jun 18, 2017

@jnothman You're right, they're numpy arrays.

@agramfort

This comment has been minimized.

Copy link
Member

agramfort commented Jun 18, 2017

LGTM

@jnothman

This comment has been minimized.

Copy link
Member

jnothman commented Jun 18, 2017

Thanks. Are we sure this does not affect other examples?

@jnothman jnothman merged commit 25917ba into scikit-learn:master Jun 18, 2017

5 checks passed

ci/circleci Your tests passed on CircleCI!
Details
codecov/patch Coverage not affected when comparing 6ef8595...e3246e0
Details
codecov/project 96.29% remains the same compared to 6ef8595
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@gusennan

This comment has been minimized.

Copy link
Contributor Author

gusennan commented Jun 19, 2017

The same issue could affect other examples--I can take a look.

Should I close issue #9148 now that you've merged to master?

@jnothman

This comment has been minimized.

Copy link
Member

jnothman commented Jun 19, 2017

amueller added a commit that referenced this pull request Jun 19, 2017

Use tuples for color specification (#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

dmohns added a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

dmohns added a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

NelleV added a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

paulha added a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

AishwaryaRK added a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

maskani-moh added a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.

MLopez-Ibanez pushed a commit to MLopez-Ibanez/scikit-learn that referenced this pull request Feb 9, 2019

Use tuples for color specification (scikit-learn#9149)
In the Matplotlib 'Specifying Colors' section, neither list nor array is a valid color specification type.  When this example is run using Python 3.5, and matplotlib 2.0.2 (latest), it errors with the message: 

"ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This change preserves the semantics of the example while allowing it to successfully run by converting to tuples for the matplotlib color specification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.