File: color_cycle.py

package info (click to toggle)
matplotlib 0.99.3-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 33,060 kB
  • ctags: 28,162
  • sloc: python: 79,063; cpp: 64,496; objc: 4,513; ansic: 1,948; makefile: 146; sh: 7
file content (28 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Illustrate the API for changing the cycle of colors used
when plotting multiple lines on a single Axes.
"""

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

yy = np.arange(24)
yy.shape = 6,4

mpl.rc('lines', linewidth=4)

fig = plt.figure()
mpl.axes.set_default_color_cycle(['r', 'g', 'b', 'c'])
ax = fig.add_subplot(2,1,1)
ax.plot(yy)
ax.set_title('Changed default color cycle to rgbc')

ax = fig.add_subplot(2,1,2)
ax.set_color_cycle(['c', 'm', 'y', 'k'])
ax.plot(yy)
ax.set_title('This axes only, cycle is cmyk')

plt.show()