File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import numpy as np
2222import matplotlib .pyplot as plt
2323import matplotlib as mpl
24+ from cycler import cycler
2425plt .style .use ('ggplot' )
2526data = np .random .randn (50 )
2627
107108# the matplotlib package. rcParams can be modified directly, for example:
108109
109110mpl .rcParams ['lines.linewidth' ] = 2
110- mpl .rcParams ['lines.color ' ] = 'r '
111+ mpl .rcParams ['lines.linestyle ' ] = '-- '
111112plt .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 = '-. ' )
119127plt .plot (data )
120128
121129###############################################################################
You can’t perform that action at this time.
0 commit comments