Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Mario Figueiredo
On Sun, 26 Apr 2015 18:55:27 + (UTC), Denis McMahon wrote: >The first thing you need to do is create a small self contained example >of your problem. > >State the problem: Plot does not create the output you expect. > >Give an example: > >plot( [1,11], [5,5] ) > >Explain what you expect the

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Denis McMahon
On Sat, 25 Apr 2015 23:33:10 +0100, Mario Figueiredo wrote: > plot(list(results.keys()), list(results.values())) I found multiple plots in matplotlib. You need to specify which one you're using. The first thing you need to do is create a small self contained example of your problem. State

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Mario Figueiredo
On Sun, 26 Apr 2015 11:17:07 +0100, Dave Farrance wrote: > >Moving average. Try: > >def movingaverage(interval, window_size): >window= numpy.ones(int(window_size))/float(window_size) >return numpy.convolve(interval, window, 'same') > >y_av = movingaverage(y,10) > >Note that you'd get prob

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Dave Farrance
Mario Figueiredo wrote: >Other than replacing the random module with the probability density >function for the exponential distribution, do you have a suggestion of >how I could smooth the curve? Moving average. Try: def movingaverage(interval, window_size): window= numpy.ones(int(window_si

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread John Ladasky
On Saturday, April 25, 2015 at 4:16:04 PM UTC-7, Mario Figueiredo wrote: [snip] > This works as intended. But plots a jagged curve due to the small > discrepancies normal of a random number generation. > > Other than replacing the random module with the probability density > function for the expon

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mark Lawrence
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 i

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
On Sat, 25 Apr 2015 23:12:19 + (UTC), Denis McMahon wrote: >Sorry, but given a choice of 5 plot methods in matplotlib and no hint as >to which one you're calling, I'm not inclined to go and look at the >arguments of all of them. There's actually around 8 I think. The individual graphs type

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
Ok. Ermm, it seems I needed to ask to finally have an epiphany. The problem is that defaultdict is unordered. Once I get the data ordered, I can finally plot the curve. Although this presents another problem... import decimal from random import expovariate from collections import defaultdict deci

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Denis McMahon
On Sat, 25 Apr 2015 23:33:10 +0100, Mario Figueiredo wrote: > plot(list(results.keys()), list(results.values())) matplotlib supports at least (from searching the website) 5 plot methods. Which one are you using? My first guess would be that the data format that plot expects isn't the forma

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
On Sat, 25 Apr 2015 23:33:10 +0100, Mario Figueiredo wrote: > >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())) > The above should read: results = generate(1) plot(list(

[Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
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 fro