I just learned about the matplotlib.rcParams feature and so I tried to plot a very simple graph.
import matplotlib.pyplot as plt
x = [1,2,3,4,5]
y = [5,3,7,9,2]
plt.rcParams['lines.color'] = 'r'
plt.rcParams['lines.linewidth'] = 3.0
plt.plot(x, y)
plt.show()
The resulting plot has increased linewidth but the color remains unchanged. The line is still blue.
When I check the plt.rcParams['lines.color'] value, it prints 'r'.
I'm using matplotlib version 1.3.1 with 32-bit Python 2.7.6.
Am I doing something wrong ?
Starting from matplotlib 1.5, mpl.rcParams['axes.color_cycle'] is deprecated. You should use axes.prop_cycle:
import matplotlib as mpl
mpl.rcParams['axes.prop_cycle'] = mpl.cycler(color=["r", "#e94cdc", "0.7"])
As mentioned in http://matplotlib.org/users/customizing.html , it has no affect on plot()
# lines.color : blue # has no affect on plot(); see axes.color_cycle
Instead, this works:
plt.rcParams['axes.color_cycle']='r'
plt.rcParams['lines.linewidth'] = 3.0
plt.plot(x, y)
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With