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

plt.plot(..., c="...") doesn't always set the color properly #4866

Closed
anntzer opened this issue Aug 5, 2015 · 2 comments
Closed

plt.plot(..., c="...") doesn't always set the color properly #4866

anntzer opened this issue Aug 5, 2015 · 2 comments

Comments

@anntzer
Copy link
Contributor

anntzer commented Aug 5, 2015

Specifically it is dependent on PYTHONHASHSEED:

$  PYTHONHASHSEED=1 python -c 'from pylab import *; plot([1, 2], [3, 4], c="g"); show()' # ==> ok
$ PYTHONHASHSEED=2 python -c 'from pylab import *; plot([1, 2], [3, 4], c="g"); show()' # ==> blue line

Pretty sure the issue happens in _process_plot_var_args._makeline which just checks whether the color kwargs is given (but doesn't check for c); if it is not it fetches the next color and uses it as the color kwarg, and whether color or c wins depends on the current hashing seed.

A bit scary...

version: matplotlib 1.4.3 packaged by Arch Linux

@efiring
Copy link
Member

efiring commented Aug 5, 2015

This is fixed in master.

On 8/4/15, Antony Lee notifications@github.com wrote:

Specifically it is dependent on PYTHONHASHSEED:

$  PYTHONHASHSEED=1 python -c 'from pylab import *; plot([1, 2], [3, 4],
c="g"); show()' # ==> ok
$ PYTHONHASHSEED=2 python -c 'from pylab import *; plot([1, 2], [3, 4],
c="g"); show()' # ==> blue line

Pretty sure the issue happens in _process_plot_var_args._makeline which
just checks whether the color kwargs is given (but doesn't check for c);
if it is not it fetches the next color and uses it as the color kwarg, and
whether color or c wins depends on the current hashing seed.

A bit scary...

version: matplotlib 1.4.3 packaged by Arch Linux


Reply to this email directly or view it on GitHub:
#4866

@tacaswell
Copy link
Member

And the workaround is to simple use 'color' instead of 'c'

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

No branches or pull requests

3 participants