Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #89399
| From | Mario Figueiredo <marfig@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | [Matplotlib] Ploting an exponential distribution frequency curve |
| Date | 2015-04-25 23:33 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <bi4ojap79mlcjq05skiar1ftrfh42j3efh@4ax.com> (permalink) |
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.
Back to comp.lang.python | Previous | Next — 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