Reputation: 42329
I might be missing something very obvious here, but I've tried numerous combinations I haven't been able to find the reason for this behavior.
I'm running Python v2.7.6 and matplotlib v1.4.3.
I have a simple plot:
import matplotlib.pyplot as plt
import numpy as np
x, y = np.random.random(50), np.random.random(50)
plt.plot(x, y, c='red', ls='-', lw=1., label='a', zorder=2)
plt.show()
Notice that the color is supposed to be red as per c='red'
. What I get instead is:
If I use the full name of the argument color='red'
, the line is red as it should. If I remove any of the arguments after c='red'
, e.g.:
plt.plot(x, y, c='red', ls='-', lw=1., label='a')
plt.plot(x, y, c='red', ls='-', lw=1., zorder=2)
plt.plot(x, y, c='red', ls='-', label='a', zorder=2)
plt.plot(x, y, c='red', lw=1., label='a', zorder=2)
the plotted line is also red.
Am I doing something very obviously wrong here or did I stumble into a weird issue?
Add:
Using:
plt.plot(x, y, c='r', ls='-', lw=1., label='a', zorder=2)
as proposed (i.e.: c='r'
instead of c='red'
) has no effect on my system, I still get the blue line.
Upvotes: 1
Views: 1604
Reputation: 42329
This is a known issue and the fix will be released with v1.5.0.
See issue at Github for more details: https://github.com/matplotlib/matplotlib/issues/5197
Upvotes: 0
Reputation: 15953
The following information work with Python 3.x and matplotlib 1.4.3
c='r'
found in docs
import matplotlib.pyplot as plt
import numpy as np
x, y = np.random.random(50), np.random.random(50)
plt.plot(x, y, c='r', ls='-', lw=1., label='a', zorder=2)
plt.show()
As it seems color='red'
and color='r'
seem to work along with c='r'
. c='red'
does not change the line color.
Upvotes: 1