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 <jamiemitchell1...@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 >
-- https://mail.python.org/mailman/listinfo/python-list