Hi,

I am interested in trying to make a cumulative distribution function in Python. I have a set of data in a numpy array and just want to plot that data.

numpyArray = [0.4, 0.3, 0.6,1.2,1.8, 0.5]

I would also like to have a vertical line on the x-axis at 0.4 and 0.8. What would be the easiet way to do this?

Thanks.

You will probably find a way to plot the data in the matplotlib gallery . Each picture comes with its source code.

I used Matplotlib and tried to create this function. I just enter in the mean and std deviation into this function. When I get the cdf plot from this function it doesn't give me the right graph. Somehow something I am doing is wrong. Can anyone tell me what I'm doing wrong? Thanks.

  def norm_cdf(mean, std):
    # 50 numbers between -3s and 3s
    x = sp.linspace(0,0.5,10)
    # CDF at these values
    y = stats.norm.cdf(x, loc=mean, scale=std)

    plt.plot(x,y, color="black")
    plt.xlabel("Current(nA)")
    plt.ylabel("Cumulative Probability")
    plt.title("Bit Trace {0} & std. deviation = {1}".format(mean, std))
    plt.draw()
    plt.show()
    return
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.