Juls Night wrote: > I'm new to matplotlib and am really enjoying using it. I'm confused by > something > though: [...] > The following code produces an error though (only the length of the vectors > have > been changed): > > from pylab import * > > x = range(11) > y = range(11) > > m,b = polyfit(x, y, 1) > > plot(x, y, 'yo', x, m*x+b, '--k')
The problem is that x is a list, not an array, and m*x yields an empty array: In [17]:m*x Out[17]:[] In [18]:m Out[18]:0.99999999999999978 In [19]:x Out[19]:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Solution: use x = arange(11) y = arange(11) Eric ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users