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

c=color not changing line color #4162

Closed
divenex opened this issue Feb 25, 2015 · 11 comments
Closed

c=color not changing line color #4162

divenex opened this issue Feb 25, 2015 · 11 comments

Comments

@divenex
Copy link

divenex commented Feb 25, 2015

In Matplotlib 1.4.3

plt.plot([0,1], c='lime', linewidth=20)

produces a blue line, while

plt.plot([0,1], color='lime', linewidth=20)

produces a green one as expected.

@tacaswell tacaswell added this to the next point release milestone Feb 25, 2015
@tacaswell
Copy link
Member

Did using c used to work?

@Tillsten
Copy link
Contributor

I can not reproduce that one, c works.

@NelleV
Copy link
Member

NelleV commented Feb 25, 2015

I can't reproduce either but I only tried on master.

Did using c used to work?


Reply to this email directly or view it on GitHub
#4162 (comment)
.

@tacaswell tacaswell modified the milestones: unassigned, next point release Feb 25, 2015
@divenex
Copy link
Author

divenex commented Feb 26, 2015

Yes, using c=color used to work for various matplotlib releases. I noticed the problem because the plots produced by some of my code suddenly changed colors after updating matplotlib.

@efiring
Copy link
Member

efiring commented Feb 26, 2015

"c" and "color" are listed in the Line2D docstring as synonyms, so they should work identically as kwargs in plot(). The problem is present on master as well as 1.4.3.

@tacaswell
Copy link
Member

Have a hunch that https://github.com/matplotlib/matplotlib/pull/3855/files caused this regression but don't have time to chase this down today.

@tacaswell
Copy link
Member

github-foo linking magic #3855

@tacaswell tacaswell modified the milestones: Color overhaul, unassigned Feb 26, 2015
@efiring
Copy link
Member

efiring commented Feb 26, 2015

Now, what I don't understand is why I can reproduce this on a recent master, and @NelleV cannot. I'm on Python 3.4:

In [1]: import matplotlib

In [2]: matplotlib.__version__
'1.5.dev1'

In [3]: %matplotlib qt

In [4]: import matplotlib.pyplot as plt

In [5]: plt.plot([0,1], c='lime', linewidth=20)
[<matplotlib.lines.Line2D at 0x1155ec080>]

That gives me a blue line.

@WeatherGod
Copy link
Member

I think I know what is happening (for once, my futile attempts at
refactoring color-cycling bears some useful knowledge!)

There are two dictionaries passed around for various reasons. While this
change improved things by not only retrieving data from either
dictionaries, but also saving information to both. Unfortunately, the code
doesn't check for the synonyms. Without "color' in the second dictionary,
the Line2D object was getting the value for 'c'. Now, 'color' shows up from
the color-cycling, overriding the 'c' argument.

On Thu, Feb 26, 2015 at 1:06 PM, Thomas A Caswell notifications@github.com
wrote:

Have a hunch that https://github.com/matplotlib/matplotlib/pull/3855/files
caused this regression but don't have time to chase this down today.


Reply to this email directly or view it on GitHub
#4162 (comment)
.

@WeatherGod
Copy link
Member

Could be different values for color-cycling in the rc?

On Thu, Feb 26, 2015 at 1:07 PM, Eric Firing notifications@github.com
wrote:

Now, what I don't understand is why I can reproduce this on a recent
master, and @NelleV https://github.com/NelleV cannot. I'm on Python 3.4:

In [1]: import matplotlib

In [2]: matplotlib.version
'1.5.dev1'

In [3]: %matplotlib qt

In [4]: import matplotlib.pyplot as plt

In [5]: plt.plot([0,1], c='lime', linewidth=20)
[<matplotlib.lines.Line2D at 0x1155ec080>]

That gives me a blue line.


Reply to this email directly or view it on GitHub
#4162 (comment)
.

@mwaskom
Copy link

mwaskom commented Mar 7, 2015

Just ran into this issue in the seaborn tests and can confirm that I see it only on Python 3.4, but not on Python 3.3 or 2.7.

mwaskom added a commit to mwaskom/seaborn that referenced this issue Mar 7, 2015
See matplotlib/matplotlib#4162 for details
on bug in matplotlib on Python 3.4 that motivates this.
@efiring efiring self-assigned this Mar 7, 2015
@efiring efiring closed this as completed in 308fae5 Mar 8, 2015
tacaswell added a commit that referenced this issue Mar 8, 2015
FIX : convert 'c' to 'color' immediately in plot

closes #4162, closes #4157
mwaskom added a commit to mwaskom/seaborn that referenced this issue Mar 13, 2015
See matplotlib/matplotlib#4162 for details
on bug in matplotlib on Python 3.4 that motivates this.
tacaswell added a commit to tacaswell/matplotlib that referenced this issue Mar 18, 2015
FIX : convert 'c' to 'color' immediately in plot

closes matplotlib#4162, closes matplotlib#4157
tacaswell added a commit that referenced this issue Mar 23, 2015
FIX : convert 'c' to 'color' immediately in plot

closes #4162, closes #4157, closes #4262
@QuLogic QuLogic modified the milestones: next point release (1.5.0), Color overhaul Oct 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants