Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Dave Farrance
Mario Figueiredo mar...@gmail.com 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=

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 davefarra...@omitthisyahooandthis.co.uk 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 =

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 18:55:27 + (UTC), Denis McMahon denismfmcma...@gmail.com 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

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 mar...@gmail.com 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)

[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

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 denismfmcma...@gmail.com 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

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

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

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

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