Menu

[r303]: / trunk / htdocs / examples / legend_demo2.py  Maximize  Restore  History

Download this file

22 lines (14 with data), 431 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python
# Make a legend for specific lines
from matplotlib.matlab import *
t1 = arange(0.0, 2.0, 0.1)
t2 = arange(0.0, 2.0, 0.01)
l1 = plot(t2, exp(-t2))
l2, l3 = plot(t2, sin(2*pi*t2), '--go', t1, log(1+t1), '.')
l4 = plot(t2, exp(-t2)*sin(2*pi*t2), 'rs-.')
legend( (l2, l4), ('oscillatory', 'damped'), 'upper right')
xlabel('time')
ylabel('volts')
title('Damped oscillation')
#savefig('legend_demo2')
show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.