In [1]:
%matplotlib inline
import pylab as plt
from numpy import *

Plotting a function

In [11]:
x = linspace(-1,2,200)  # numpy.linspace generates an array of uniformly spaced values
plt.plot(x, exp(-2*x));

Plotting a family of functions

In [12]:
for c in [-3,-2,-1,0,1,2,3]:
    plt.plot(x, c*exp(-2*x))

You can control the colors and linewidths if you like:

In [13]:
for c,mycolor,mywidth in zip([-3,-2,-1,0,1,2,3],'kkrkkk',[1,1,5,1,1,1,1]):
    plt.plot(x, c*exp(-2*x), color=mycolor, lw=mywidth)
In [ ]: