File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 21
21
import numpy as np
22
22
import matplotlib .pyplot as plt
23
23
import matplotlib as mpl
24
+ from cycler import cycler
24
25
plt .style .use ('ggplot' )
25
26
data = np .random .randn (50 )
26
27
107
108
# the matplotlib package. rcParams can be modified directly, for example:
108
109
109
110
mpl .rcParams ['lines.linewidth' ] = 2
110
- mpl .rcParams ['lines.color ' ] = 'r '
111
+ mpl .rcParams ['lines.linestyle ' ] = '-- '
111
112
plt .plot (data )
112
113
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
+
113
121
###############################################################################
114
122
# Matplotlib also provides a couple of convenience functions for modifying rc
115
123
# settings. `matplotlib.rc` can be used to modify multiple
116
124
# settings in a single group at once, using keyword arguments:
117
125
118
- mpl .rc ('lines' , linewidth = 4 , color = 'g ' )
126
+ mpl .rc ('lines' , linewidth = 4 , linestyle = '-. ' )
119
127
plt .plot (data )
120
128
121
129
###############################################################################
You can’t perform that action at this time.
0 commit comments