creating a multi colored graph with respect to the values in y-axis

Hi all,
I am a beginner in python and matplotlib. I need to implement a graph with multiple
colors in it.
In a way, I have a function which varies with respect to time and
amplitude. I have time on x-axis and amplitude on y-axis. Lets say the

amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9,
10-13. I need to plot the graph in such a way that, when the values of
amplitude are in a particular range say 1-3, the color of graph should
be red.

If the amplitude is in the range from 3-5 the graph need to be in
color blue etc…,

There is no specific pattern of variation of the amplitude with respect to time i.e at time instance say 3 seconds. the amplitude can be 11 and next instance amplitude comes down to say 3.

I did find an example post

http://groups.google.com/group/comp.lang.python/browse_thread/thread/fdefe924cc7d4d31

but I was not able to figure out how to use it.

Can somebody guide me on this, how to achive this functionality.

Regards,
Ravikanth