【发布时间】:2020-07-16 17:08:32
【问题描述】:
我有一个评分列表,我正在为其绘制直方图。在左侧(y 轴)显示频率计数,有没有办法根据流量显示百分比。
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.hist(item['ratings'], bins = 5)
ax.legend()
ax.set_title("Ratings Frequency")
ax.set_xlabel("Ratings")
ax.set_ylabel("frequency")
ax.axhline(y=0, linestyle='--', color='k')
【问题讨论】:
标签: python matplotlib graph