Matplotlib柱状图中的PyPlot线

2024-09-30 20:35:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我是matplotlib的pyplot的初学者,想知道如何在柱状图的条形图之间获得黑线。我做了一些谷歌搜索和others were seeming to get this behavior开箱即用的命令。在

enter image description here


Tags: to命令getmatplotlibthis条形图pyplot开箱
1条回答
网友
1楼 · 发布于 2024-09-30 20:35:25

matplotlib版本2中,直方图中的透明边成为默认值(Reference),要修改它,只需将edgecolor = 'black'参数添加到plt.hist中:

plt.hist(data, 20, alpha=.5, edgecolor = 'black')

随机数据演示:

^{pr2}$

相关问题 更多 >