From 432638aa4341e64e224e143da87cec6c05286e4d Mon Sep 17 00:00:00 2001 From: kopytjuk Date: Fri, 21 Feb 2020 18:56:52 +0100 Subject: [PATCH 1/3] Fix documentation to change cycler instead of lines.color. --- tutorials/introductory/customizing.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index c2996cf0eeb7..c3433a9ae7d4 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -107,15 +107,24 @@ # 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`: + +from cycler import cycler + +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. `matplotlib.rc` 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) ############################################################################### From bfeeb7ff9fc31065bd4750f05ed2ecf30a5a12f1 Mon Sep 17 00:00:00 2001 From: Marat K Date: Wed, 26 Feb 2020 18:01:06 +0100 Subject: [PATCH 2/3] Update customizing.py --- tutorials/introductory/customizing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index c3433a9ae7d4..69f1146d626a 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -112,7 +112,7 @@ ############################################################################### # Note, that in order to change the usual `plot` color you have to change the -# `prop_cycle` property of `axes`: +# *prop_cycle* property of *axes*: from cycler import cycler From 4100059df40092f74f11373717a15f482bcaeb5f Mon Sep 17 00:00:00 2001 From: kopytjuk Date: Wed, 26 Feb 2020 20:03:47 +0100 Subject: [PATCH 3/3] Fix flake8 bugs. --- tutorials/introductory/customizing.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index 69f1146d626a..718cc6414e19 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) @@ -111,13 +112,11 @@ plt.plot(data) ############################################################################### -# Note, that in order to change the usual `plot` color you have to change the +# Note, that in order to change the usual `plot` color you have to change the # *prop_cycle* property of *axes*: -from cycler import cycler - mpl.rcParams['axes.prop_cycle'] = cycler(color=['r', 'g', 'b', 'y']) -plt.plot(data) # first color is red +plt.plot(data) # first color is red ############################################################################### # Matplotlib also provides a couple of convenience functions for modifying rc