Revisión | 0ad420e2d7a8d7854c7ce0752ff55a7a2d260bb8 (tree) |
---|---|
Tiempo | 2008-03-17 00:45:21 |
Autor | iselllo |
Commiter | iselllo |
I added test_pylab_multiple_linestyles.py: it shows how to create a
figure with multiple INDEPENDENT line styles. It first creates a figure
object and then it draws upon it.
@@ -0,0 +1,33 @@ | ||
1 | +#! /usr/bin/env python | |
2 | + | |
3 | + | |
4 | +import pylab as p | |
5 | +import numpy as n | |
6 | +import scipy as s | |
7 | + | |
8 | +x = s.arange(0.0, 2, 0.1) | |
9 | +y1 = s.sin(s.pi*x) | |
10 | +y2 = s.cos(s.pi*x) | |
11 | + | |
12 | +### Plot it ### | |
13 | + | |
14 | +fig = p.figure() | |
15 | +axes = fig.gca() | |
16 | + | |
17 | +axes.plot(x, y1, '--b', label='LW=1', linewidth=1) | |
18 | +axes.plot(x, y1+0.5, '--r', label='LW=2', linewidth=2) | |
19 | +axes.plot(x, y1+1.0, '--k', label='LW=3', linewidth=3) | |
20 | + | |
21 | +axes.plot(x, y2, 'xr', label='MS=3', markersize=3) | |
22 | +axes.plot(x, y2+0.5, 'xk', label='MS=5', markersize=5) | |
23 | +axes.plot(x, y2+1.0, 'xb', label='MS=7', markersize=7) | |
24 | + | |
25 | +axes.legend() | |
26 | + | |
27 | +#app.MainLoop() | |
28 | +p.savefig("my_figure.pdf") | |
29 | + | |
30 | +print "So far so good" | |
31 | + | |
32 | + | |
33 | + |