【发布时间】:2020-03-29 20:39:40
【问题描述】:
我正在使用轴在同一个图中绘制两个归一化直方图,并希望有一个能够捕获任何高于 6000 的值的 bin。这是我到目前为止所做的:-
fig,ax=plt.subplots(1,2)
x1 = (60, 80, 1000, 7000, 8000)
x2 = (9000, 10000, 11000, 12000, 13000)
weights1= np.ones_like(x1)/float(len(x1))
weights2= np.ones_like(x2)/float(len(x2))
bins= np.arange(0, 6000, 100)
ax[0].hist(np.clip(x1, bins[0], bins[-1]), bins=bins, weights=weights1,
alpha =.5, label = "A", color = "blue")
ax[1].hist(np.clip(x2, bins[0], bins[-1]), bins=bins, weights=weights2,
alpha =.5, label = "B", red = "red")
plt.show()
如何将 x 刻度标签从 6000 更改为 6000+,以表明它捕获了高于该值的所有观察结果?
【问题讨论】:
标签: python matplotlib