【发布时间】:2016-08-06 08:37:40
【问题描述】:
当我运行我的代码来生成数据集的相对累积频率的图表时,我的图表会在图表与右侧的线 y=1 like this one 相交处出现一条直线。
y 轴限制在y=0 到y=1 的范围内,代表累积频率的0% 到100%,一旦图表达到y=1 或100%,它应该 em> 在y=1 处继续直到x 轴的上限,即从x=0 到x=2,类似于this graph。
在达到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)
谢谢,马克斯
【问题讨论】:
标签: python matplotlib graph