Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9030159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:25:14+00:00 2026-06-16T07:25:14+00:00

I have been using ECDF (empirical cumulative distribution function) from statsmodels.distributions to plot a

  • 0

I have been using ECDF (empirical cumulative distribution function) from statsmodels.distributions to plot a CDF of some data. However, ECDF uses a step function and as a consequence I get jagged-looking plots.

enter image description here

So my question is: Do scipy or statsmodels have a ECDF baked-in without a step function?

By the way, I know I can do this:

hist, bin_edges = histogram(b_oz, normed=True)
plot(np.cumsum(hist))

but I don’t get the right scales.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:25:15+00:00Added an answer on June 16, 2026 at 7:25 am

    If you just want to change the plot, then you could let matplotlib interpolate between the observed values.

    >>> xx = np.random.randn(nobs)
    >>> ecdf = sm.distributions.ECDF(xx)
    >>> plt.plot(ecdf.x, ecdf.y)
    [<matplotlib.lines.Line2D object at 0x07A872D0>]
    >>> plt.show()
    

    or sort original data and plot

    >>> xx.sort()
    >>> plt.plot(xx, ecdf(xx))
    [<matplotlib.lines.Line2D object at 0x07A87090>]
    >>> plt.show()
    

    which is the same as plotting it directly

    >>> a=0; plt.plot(xx, np.arange(1.,nobs+1)/(nobs+a))
    [<matplotlib.lines.Line2D object at 0x07A87D30>]
    >>> plt.show()
    

    Note: depending on how you want the ecdf to behave at the boundaries and how it will be centered, there are different normalizations for “plotting positions” that are in common use, like the parameter a that I added as example a=1 is a common choice.

    As alternative to using the empirical cdf, you could also use an interpolated or smoothed ecdf or histogram, or a kernel density estimate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using Matlab 2011b and contourf/contourfm to plot 2D data on a
Have been using the SharpeRatio.annualized() function from Performance Analytics for awhile with no problems.
I have been using the following function to get regular parameters from the current
I have been using TortoiseSVN for some time and I really like it. I
I have been using an API to do some work. This is how I
I have been using some Javascript to create a text field once an certain
I have been using msgsend and receive from #include <sys/ipc.h> #include <sys/msg.h> for quite
I have been using SampleFTP from Apple but I cannot understand the procedure, I
I am not really sure about the difference between CDF (Cumulative Distribution Function) and
I have been using a reset CSS set of styles for quite some time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.