仅绘制直方图中的顶线

问题描述 投票:0回答:1

我有一个

matplotlib
图,它在同一个图中绘制了多个(大约 4-5 个)不同的直方图。然而,为了防止它变得太拥挤,我想绘制相同的直方图,但只有顶部水平线(所以它看起来像一条
plt.plot()
连续线,但由很多步骤组成)。我该怎么办?

python matplotlib histogram
1个回答
1
投票

使用关键字参数

plt.hist(data,histtype='step')
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.hist.html

© www.soinside.com 2019 - 2024. All rights reserved.