我正在尝试绘制一些数据的pdf和CDF。我已将标签放入pyplot函数中,但仍不可见
counts, bin_edges = np.histogram(haberman['Age'],bins=10,density=True)
pdf = counts/(sum(counts))
print(pdf);
print(bin_edges);
cdf = np.cumsum(pdf)
plt.plot(bin_edges[1:],pdf,'-b', label='Pdf');
plt.plot(bin_edges[1:], cdf,'-r', label= 'cdf');
plt.show()
理想情况下,它应该在pyplot中显示图例