Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69430

Re: Line of best fit

References <0fb15100-15e8-46d6-a38f-b187c7012e62@googlegroups.com>
Date 2014-03-31 13:50 +0200
Subject Re: Line of best fit
From Moritz Beber <moritz.beber@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8742.1396272420.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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@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
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Line of best fit Jamie Mitchell <jamiemitchell1604@gmail.com> - 2014-03-31 04:29 -0700
  Re: Line of best fit Roy Smith <roy@panix.com> - 2014-03-31 08:21 -0400
    Re: Line of best fit Sturla Molden <sturla.molden@gmail.com> - 2014-04-01 00:44 +0000
  Re: Line of best fit Moritz Beber <moritz.beber@gmail.com> - 2014-03-31 13:50 +0200
  Re: Line of best fit Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-01 01:00 +0000

csiph-web