如何在Python中生成CDF?

2024-09-30 08:33:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我做了PDF,这是下面的历史代码

plt.figure()

values1,bins1,_ = plt.hist(np.log10(fakeclusterlum),bins=20)

plt.hist(np.log10(bigclusterlum151mh),alpha = .5,bins = bins1)

但我不知道怎么把它画成CDF?我要画出假ClusterLum和bigclusterlum151mh点。如果这是有道理的如果它不,我道歉,我有点初学者!在


Tags: 代码alphapdfnpplt历史histfigure
1条回答
网友
1楼 · 发布于 2024-09-30 08:33:32

pyplot.hist有一个参数

cumulative : bool, optional
If True, then a histogram is computed where each bin gives the counts in that bin plus all bins for smaller values. The last bin gives the total number of datapoints.
Default: False

因此使用

plt.hist(..., cumulative=True)

绘制累积直方图。在

相关问题 更多 >

    热门问题