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


Groups > comp.lang.python > #69430

Re: Line of best fit

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <moritz.beber@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'url:sourceforge': 0.03; 'essentially': 0.04; 'cc:addr:python-list': 0.11; 'python': 0.11; 'question.': 0.14; 'subject:Line': 0.16; 'wrote:': 0.18; 'library': 0.18; 'fit': 0.20; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; '31,': 0.24; 'mon,': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'files': 0.38; 'pm,': 0.38; 'skip:p 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'new': 0.61; 'to:addr:gmail.com': 0.65; 'url:0': 0.67; 'mar': 0.68; 'url:reference': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=t/yoVLI2htlqtYc2Vq2hngJQyLQsPqHAI08babH6C2Y=; b=TufvuBhZrVFVKIkpIrl8CARhxPJkgGaGt0Hmr7hAHEaRzXRKAstCLJf/DmSItUa6Ug L+RLjFL/D3MR6++6BX1I0SDX83fAL3A8oz27gaBA2HmuGnPgQOPGM/kYfQKhvM/dpOrS cBMmqul3oCebRfjVfRNPikmE/BQ8trXrdROJPJryfqW40d2iBR0oIdt1usIuzgAXtSDG r9x+So4HC8sr/+aPlDDBrtGQp78xIi0HA1n1hjZGhzgWox+OCPHZGtKJNnNx09gJbfit DS0fH2bDBeF0GEwUm3rt5s+w4qrELGTUamVvQILeLX+7IK5mWOoG1PacW02zt/vo29+Q A5fA==
MIME-Version 1.0
X-Received by 10.140.107.229 with SMTP id h92mr25181164qgf.30.1396266653616; Mon, 31 Mar 2014 04:50:53 -0700 (PDT)
In-Reply-To <0fb15100-15e8-46d6-a38f-b187c7012e62@googlegroups.com>
References <0fb15100-15e8-46d6-a38f-b187c7012e62@googlegroups.com>
Date Mon, 31 Mar 2014 13:50:53 +0200
Subject Re: Line of best fit
From Moritz Beber <moritz.beber@gmail.com>
To Jamie Mitchell <jamiemitchell1604@gmail.com>
Content-Type multipart/alternative; boundary=001a113a6020e6901104f5e5a9f1
X-Mailman-Approved-At Mon, 31 Mar 2014 15:26:58 +0200
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8742.1396272420.18130.python-list@python.org> (permalink)
Lines 84
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1396272420 news.xs4all.nl 2952 [2001:888:2000:d::a6]:48205
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69430

Show key headers only | 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