awips2/pythonPackages/matplotlib/examples/pylab_examples/axes_demo.py
root 57877615f5 Initial revision of AWIPS2 11.9.0-7p5
Former-commit-id: 2b462d8665 [formerly 133dc97f67] [formerly a02aeb236c] [formerly a02aeb236c [formerly 9f19e3f712]] [formerly 2b462d8665 [formerly 133dc97f67] [formerly a02aeb236c] [formerly a02aeb236c [formerly 9f19e3f712]] [formerly 06a8b51d6d [formerly a02aeb236c [formerly 9f19e3f712] [formerly 06a8b51d6d [formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]]]
Former-commit-id: 06a8b51d6d
Former-commit-id: 2c3569dd39 [formerly 9bb8decbcf] [formerly 8e80217e59] [formerly e2ecdcfe33 [formerly 377dcd10b9] [formerly 8e80217e59 [formerly 3360eb6c5f]]]
Former-commit-id: e2ecdcfe33 [formerly 377dcd10b9]
Former-commit-id: e2ecdcfe33
Former-commit-id: 7dbd17a5aa
2012-01-06 08:55:05 -06:00

32 lines
774 B
Python
Executable file

#!/usr/bin/env python
from pylab import *
# create some data to use for the plot
dt = 0.001
t = arange(0.0, 10.0, dt)
r = exp(-t[:1000]/0.05) # impulse response
x = randn(len(t))
s = convolve(x,r)[:len(x)]*dt # colored noise
# the main axes is subplot(111) by default
plot(t, s)
axis([0, 1, 1.1*amin(s), 2*amax(s) ])
xlabel('time (s)')
ylabel('current (nA)')
title('Gaussian colored noise')
# this is an inset axes over the main axes
a = axes([.65, .6, .2, .2], axisbg='y')
n, bins, patches = hist(s, 400, normed=1)
title('Probability')
setp(a, xticks=[], yticks=[])
# this is another inset axes over the main axes
a = axes([0.2, 0.6, .2, .2], axisbg='y')
plot(t[:len(r)], r)
title('Impulse response')
setp(a, xlim=(0,.2), xticks=[], yticks=[])
show()