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


Groups > comp.lang.python > #89412

Re: [Matplotlib] Ploting an exponential distribution frequency curve

Newsgroups comp.lang.python
Date 2015-04-25 22:08 -0700
References <bi4ojap79mlcjq05skiar1ftrfh42j3efh@4ax.com> <sj5ojalp0ilnnip6914dp52ok44pj848ql@4ax.com> <4m7oja1sgl70l3vfiftb3r8kl74kcdf7b4@4ax.com>
Message-ID <5b6e36b5-e58c-474b-b619-2bbabbc6c33a@googlegroups.com> (permalink)
Subject Re: [Matplotlib] Ploting an exponential distribution frequency curve
From John Ladasky <john_ladasky@sbcglobal.net>

Show all headers | View raw


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 exponential distribution, do you have a suggestion of
> how I could smooth the curve?

Since you have a finite data set which only approximates the exponential distribution, a visual representation which connects the dots with line segments will definitely emphasize the noise in your data.

Matplotlib.pyplot has another useful function, scatter().  Scatter does not draw lines between adjacent values.  Start there.  See how your eye likes that.

If you really want to show a curve, and you do not want to calculate the limiting (infinite data samples) exponential variate on which your sample would eventually converge, you could construct moving averages using a sliding-window sample of the points (ordered by x value, of course) and then connect those averages.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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