[SciPy-user] Plotting an array
Ryan Krauss
ryanlists at gmail.com
Tue Oct 10 13:35:50 EDT 2006
It seems like you are somehow plotting t as an integer. print t to
your command window and check it out.
If I just do t=arange(0,2.0,0.1) and plot(t) I get a plot that looks
like your test2.png and my t is:
t = arange(0, 2.0, 0.1)
Ryan
On 10/10/06, Andrew B. Young <andrew.young at sri.com> wrote:
> 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
> >
>
>
> _______________________________________________
> 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