[SciPy-user] Plotting an array

Andrew B. Young andrew.young at sri.com
Tue Oct 10 10:13:03 CDT 2006

I believe this is a rookie question but the I've not discovered the
answer so easily.  The code below, copied from a posting I found,
produces a graph with a straight line across zero.  Plotting just t,
plot(t), produces a line either zero or one.  I am sure it has
something to do with plotting an array versus plotting a python list.
I would be happy for a pointer to the reference material for me to
read.  http://www.scipy.org/Documentation has not yet lead me to the

  t = arange(0, 2.0, 0.1)
  y = sin(2*pi*t)
  tck = interpolate.splrep(t, y, s=0)
  tnew = arange(0, 2.0, 0.01)
  ynew = interpolate.splev(tnew, tck, der=0)
  plot(t, y, 'o', tnew, ynew)

Andrew Young

Python 2.4.3 (#1, Jun 13 2006, 11:46:08), [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2

More information about the SciPy-user mailing list