Line of best fit

Moritz Beber moritz.beber at gmail.com
Mon Mar 31 13:50:53 CEST 2014


None of these are in the standard library but why re-invent the wheel?

Using numpy:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html

scipy:
http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.stats.linregress.html

statsmodels:
http://statsmodels.sourceforge.net/devel/examples/notebooks/generated/ols.html


On Mon, Mar 31, 2014 at 1:29 PM, Jamie Mitchell <jamiemitchell1604 at gmail.com
> wrote:

> I am new to python so apologies for the ignorance with this question.
>
> How would I apply a line of best fit to a plot?
>
> My data are netCDF4 data files and this is essentially what I have done so
> far:
>
> swh1=netCDF4.Dataset('filename','r')
> hs1=swh1.variables['hs']
>
> swh2=netCDF4.Dataset('filename'.'r')
> hs2=swh2.variables['hs']
>
> plt.plot(hs1,hs2,'.')
>
> Cheers,
>
> Jamie
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140331/91876293/attachment.html>


More information about the Python-list mailing list