File: filledmarker_demo.py

package info (click to toggle)
matplotlib 1.1.1~rc2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 66,076 kB
  • sloc: python: 90,600; cpp: 69,891; objc: 5,231; ansic: 1,723; makefile: 171; sh: 7
file content (38 lines) | stat: -rw-r--r-- 1,100 bytes parent folder | download | duplicates (3)
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
29
30
31
32
33
34
35
36
37
38
import itertools

import numpy as np
import matplotlib.lines as mlines
import matplotlib.pyplot as plt

colors = itertools.cycle(['b', 'g', 'r', 'c', 'm', 'y', 'k'])
altcolor = 'lightgreen'

plt.rcParams['text.usetex'] = False # otherwise, '^' will cause trouble

y = np.arange(10)
for marker in mlines.Line2D.filled_markers:
    f = plt.figure()
    f.text(.5,.95, "marker = %r" % marker, ha='center')
    for i,fs in enumerate(mlines.Line2D.fillStyles):
        color = colors.next()

        ax = f.add_subplot(121)
        ax.plot(2*(4-i)+y, c=color,
                       marker=marker,
                       markersize=20, 
                       fillstyle=fs, 
                       label=fs)
        ax.legend(loc=2)
        ax.set_title('fillstyle')

        ax = f.add_subplot(122)
        ax.plot(2*(4-i)+y, c=color,
                       marker=marker,
                       markersize=20,
                       markerfacecoloralt=altcolor,
                       fillstyle=fs,
                       label=fs)
        ax.legend(loc=2)
        ax.set_title('fillstyle')

plt.show()