Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0a4fc95

Browse filesBrowse files
authored
Merge pull request #16620 from meeseeksmachine/auto-backport-of-pr-16564-on-v3.2.x
Backport PR #16564 on branch v3.2.x (Fix documentation to change cycler instead of lines.color.)
2 parents 6f21e75 + bc497f0 commit 0a4fc95
Copy full SHA for 0a4fc95

File tree

Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed

‎tutorials/introductory/customizing.py

Copy file name to clipboardExpand all lines: tutorials/introductory/customizing.py
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import numpy as np
2222
import matplotlib.pyplot as plt
2323
import matplotlib as mpl
24+
from cycler import cycler
2425
plt.style.use('ggplot')
2526
data = np.random.randn(50)
2627

@@ -107,15 +108,22 @@
107108
# the matplotlib package. rcParams can be modified directly, for example:
108109

109110
mpl.rcParams['lines.linewidth'] = 2
110-
mpl.rcParams['lines.color'] = 'r'
111+
mpl.rcParams['lines.linestyle'] = '--'
111112
plt.plot(data)
112113

114+
###############################################################################
115+
# Note, that in order to change the usual `plot` color you have to change the
116+
# *prop_cycle* property of *axes*:
117+
118+
mpl.rcParams['axes.prop_cycle'] = cycler(color=['r', 'g', 'b', 'y'])
119+
plt.plot(data) # first color is red
120+
113121
###############################################################################
114122
# Matplotlib also provides a couple of convenience functions for modifying rc
115123
# settings. The :func:`matplotlib.rc` command can be used to modify multiple
116124
# settings in a single group at once, using keyword arguments:
117125

118-
mpl.rc('lines', linewidth=4, color='g')
126+
mpl.rc('lines', linewidth=4, linestyle='-.')
119127
plt.plot(data)
120128

121129
###############################################################################

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.