当我运行我的代码来生成一个数据集的相对累积频率的图时,我的图会在图与右边的y=1
交叉的点处显示一条直线,like this one。在
y轴被限制在y=0
到{y=1
,或100%,它应该继续在y=1
直到x轴的上限,从x=0
到{
有什么方法可以确保到达y=1
之后的y=1
处的直方图是连续的吗?我需要x轴保持在范围[0,2]上,y轴保持在范围[0,1]上。在
下面是我用来生成图形的Python代码:
import matplotlib.pyplot as plt
# ...
plt.ylabel('Relative Cumulative Frequency')
plt.xlabel('Normalized Eigenvalues')
plt.hist(e.real, bins = 50, normed=1, histtype='step', cumulative=True)
# Limit X and Y ranges
plt.xlim(0, 2)
plt.ylim(0, 1)
谢谢,麦克斯
您可以通过创建自己的垃圾箱和setting the last bin to ^{} 来完成此操作:
相关问题 更多 >
编程相关推荐