[SciPy-user] Plotting an array

Andrew B. Young andrew.young at sri.com
Tue Oct 10 12:30:59 CDT 2006


Gael,

The following little program--
-- test.py ----------------------
| from scipy import arange, sin, pi, interpolate
| from pylab import plot, show, savefig
| t = arange(0, 2.0, 0.1)
| plot(t)
| savefig('test.png')

Produces the plot at http://polar.sri.com/~ayoung/test.png

Why does the plot "turn on" at one?  If I,
  plot( [ 0. ,  0.1,  0.2,  0.3,  0.4,  0.5,  0.6,  0.7,  0.8,  0.9,  1. 
, 1.1,  1.2,  1.3,  1.4,  1.5,  1.6,  1.7,  1.8,  1.9] )
I get what I would expect:  http://polar.sri.com/~ayoung/test2.png

Thanks for you help.
-andyy

Gael Varoquaux wrote:
>     Hi,
>
> Can you give a complete minimum example that does not work. If I put the
> following code in a file and run python on it, I get the expected result.
>
> from scipy import *
> from pylab import *
> 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)
> show()
>
>
> Gaël
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   




More information about the SciPy-user mailing list