diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index 39cb457e9c66..d44c77df1eb5 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -21,6 +21,7 @@ import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl +from cycler import cycler plt.style.use('ggplot') data = np.random.randn(50) @@ -107,15 +108,22 @@ # the matplotlib package. rcParams can be modified directly, for example: mpl.rcParams['lines.linewidth'] = 2 -mpl.rcParams['lines.color'] = 'r' +mpl.rcParams['lines.linestyle'] = '--' plt.plot(data) +############################################################################### +# Note, that in order to change the usual `plot` color you have to change the +# *prop_cycle* property of *axes*: + +mpl.rcParams['axes.prop_cycle'] = cycler(color=['r', 'g', 'b', 'y']) +plt.plot(data) # first color is red + ############################################################################### # Matplotlib also provides a couple of convenience functions for modifying rc # settings. The :func:`matplotlib.rc` command can be used to modify multiple # settings in a single group at once, using keyword arguments: -mpl.rc('lines', linewidth=4, color='g') +mpl.rc('lines', linewidth=4, linestyle='-.') plt.plot(data) ###############################################################################