Fixes #9148: Use tuples for color specification #9149

Merged
merged 1 commit into from Jun 18, 2017

Conversation

Projects
None yet
3 participants
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

This comment has been minimized.

Show comment Hide comment
@jnothman

jnothman Jun 17, 2017

Owner

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

Owner

jnothman commented Jun 17, 2017

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

This comment has been minimized.

Show comment Hide comment
@gusennan

gusennan Jun 18, 2017

Contributor

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

Contributor

gusennan commented Jun 18, 2017

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

This comment has been minimized.

Show comment Hide comment
@agramfort

agramfort Jun 18, 2017

Owner

LGTM

Owner

agramfort commented Jun 18, 2017

LGTM

This comment has been minimized.

Show comment Hide comment
@jnothman

jnothman Jun 18, 2017

Owner

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

Owner

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

This comment has been minimized.

Show comment Hide comment
@gusennan

gusennan Jun 19, 2017

Contributor

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

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

Contributor

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?

This comment has been minimized.

Show comment Hide comment
@jnothman

jnothman Jun 19, 2017

Owner
Owner

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.

bribroder added a commit to pewresearch/scikit-learn that referenced this pull request Aug 2, 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 (#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 (#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 (#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 (#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 (#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 (#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 (#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