Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #89407
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: [Matplotlib] Ploting an exponential distribution frequency curve |
| Date | 2015-04-26 01:31 +0100 |
| References | <bi4ojap79mlcjq05skiar1ftrfh42j3efh@4ax.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.21.1430008291.3680.python-list@python.org> (permalink) |
On 25/04/2015 23:33, Mario Figueiredo wrote:
> I'm trying to plot the curve of an exponential distribution without
> much success. I'm missing something very basic I feel, but just can't
> figure it out after numerous tries, so I'm turning out to you.
>
> This is the function generating the frequency of individual outcomes:
>
> import decimal
> from random import expovariate
> from collections import defaultdict
>
> decimal.getcontext().prec = 4
> Dec = decimal.Decimal
>
> samples = 100000 # 100,000
>
> def generate(lambd):
> res = defaultdict(int)
> for _ in range(samples):
> res[Dec(expovariate(lambd)).quantize(Dec('0.01'))] += 1
> return res
>
> Trying to plot this data into a frequency curve is proving too
> challenging and I just can't understand why.
>
> plot(list(results.keys()), list(results.values()))
>
> This results in strange line graph where there is the outline of an
> exponential curve but the line crisscrosses all over the place. I
> can't understand why I am getting this graph result and not just the
> smooth line I can infer from looking at the hard data.
>
Anything that can hep you here
http://matplotlib.org/gallery.html#statistics ?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[Matplotlib] Ploting an exponential distribution frequency curve Mario Figueiredo <marfig@gmail.com> - 2015-04-25 23:33 +0100
Re: [Matplotlib] Ploting an exponential distribution frequency curve Mario Figueiredo <marfig@gmail.com> - 2015-04-25 23:36 +0100
Re: [Matplotlib] Ploting an exponential distribution frequency curve Mario Figueiredo <marfig@gmail.com> - 2015-04-26 00:15 +0100
Re: [Matplotlib] Ploting an exponential distribution frequency curve John Ladasky <john_ladasky@sbcglobal.net> - 2015-04-25 22:08 -0700
Re: [Matplotlib] Ploting an exponential distribution frequency curve Dave Farrance <DaveFarrance@OMiTTHiSyahooANDTHiS.co.uk> - 2015-04-26 11:17 +0100
Re: [Matplotlib] Ploting an exponential distribution frequency curve Mario Figueiredo <marfig@gmail.com> - 2015-04-26 13:32 +0100
Re: [Matplotlib] Ploting an exponential distribution frequency curve Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-25 23:12 +0000
Re: [Matplotlib] Ploting an exponential distribution frequency curve Mario Figueiredo <marfig@gmail.com> - 2015-04-26 00:35 +0100
Re: [Matplotlib] Ploting an exponential distribution frequency curve Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-04-26 01:31 +0100
Re: [Matplotlib] Ploting an exponential distribution frequency curve Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-26 18:55 +0000
Re: [Matplotlib] Ploting an exponential distribution frequency curve Mario Figueiredo <marfig@gmail.com> - 2015-04-26 20:57 +0100
csiph-web