File: random_amplitudes_times.py

package info (click to toggle)
nipy 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,352 kB
  • sloc: python: 39,115; ansic: 30,931; makefile: 210; sh: 93
file content (22 lines) | stat: -rw-r--r-- 596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
This figure is meant to represent an event-type design with
events at random times centered [0,2,4,6,8] and random
amplitudes centered [0,1.1,2.3,0.9,0.3].
"""

import matplotlib
import numpy as np
import pylab

for t, y in zip([0,4,8,12,16], [0,1.1,2.3,0.9,0.3]):
    dt = np.array([-0.5,0.5,0.5,-0.5])
    dy = np.array([-0.1,-0.1,0.1,0.1])
    pylab.fill(t+dt,y+dy, 'r')

a = pylab.gca()
a.set_yticks([0,2])
a.set_xlim([-1,18])
a.set_xlabel('Time')
a.set_ylabel('Amplitude')