擅长:python、mysql、java
<p>我知道我去晚会迟到了。但是,如果您只想让cdf用于绘图而不用于将来的计算,则有一种更简单的方法:</p>
<pre><code>plt.hist(put_data_here, normed=True, cumulative=True, label='CDF',
histtype='step', alpha=0.8, color='k')
</code></pre>
<p>例如,生成<a href="https://i.imgur.com/DHpCofm.png" rel="noreferrer">one of these graphs</a>的相关代码是:</p>
<pre><code>plt.hist(dataset, bins=bins, normed=True, cumulative=True, label='CDF DATA',
histtype='step', alpha=0.55, color='purple')
# bins and (lognormal / normal) datasets are pre-defined
</code></pre>
<p>从matplotlib文档中编辑:<a href="http://matplotlib.org/examples/statistics/histogram_demo_cumulative.html" rel="noreferrer">This example</a>可能更有帮助。</p>