Former-commit-id:2b462d8665
[formerly133dc97f67
] [formerlya02aeb236c
] [formerlya02aeb236c
[formerly9f19e3f712
]] [formerly2b462d8665
[formerly133dc97f67
] [formerlya02aeb236c
] [formerlya02aeb236c
[formerly9f19e3f712
]] [formerly06a8b51d6d
[formerlya02aeb236c
[formerly9f19e3f712
] [formerly06a8b51d6d
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]]] Former-commit-id:06a8b51d6d
Former-commit-id:2c3569dd39
[formerly9bb8decbcf
] [formerly8e80217e59
] [formerlye2ecdcfe33
[formerly377dcd10b9
] [formerly8e80217e59
[formerly3360eb6c5f
]]] Former-commit-id:e2ecdcfe33
[formerly377dcd10b9
] Former-commit-id:e2ecdcfe33
Former-commit-id:7dbd17a5aa
24 lines
628 B
Python
Executable file
24 lines
628 B
Python
Executable file
#!/usr/bin/env python
|
|
#
|
|
# Make a legend for specific lines.
|
|
from pylab import *
|
|
|
|
t1 = arange(0.0, 2.0, 0.1)
|
|
t2 = arange(0.0, 2.0, 0.01)
|
|
|
|
# note that plot returns a list of lines. The "l1, = plot" usage
|
|
# extracts the first element of the list inot l1 using tuple
|
|
# unpacking. So l1 is a Line2D instance, not a sequence of lines
|
|
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', shadow=True)
|
|
xlabel('time')
|
|
ylabel('volts')
|
|
title('Damped oscillation')
|
|
#axis([0,2,-1,1])
|
|
show()
|
|
|
|
|
|
|