Numpy直方图之间没有边界[重复]

时间:2021-02-04 14:56:50

This question already has an answer here:

这个问题在这里已有答案:

I wonder why the bins are not showing a boundary between each other. It's confusing to look at it. I attached an example below:

我想知道为什么垃圾桶没有显示彼此之间的界限。看它看起来很混乱。我在下面附上一个例子:

Numpy直方图之间没有边界[重复]

for key,value in dict.items():
    plt.figure()
    plt.hist( value, bins='auto') 
    plt.title("Histogram for THR")
    plt.show()

1 个解决方案

#1


1  

That's the new default style for matplotlib 2.0 (for example, see the plots from the documentation for plt.hist in v2.0).

这是matplotlib 2.0的新默认样式(例如,请参阅v2.0中plt.hist文档中的图表)。

To force the edges of the bins to be displayed you can pass the edgecolor= (or ec=) argument to plt.hist, e.g. plt.hist(values, bins='auto', ec='k') for black bin edges.

要强制显示bin的边缘,可以将edgecolor =(或ec =)参数传递给plt.hist,例如黑色bin边缘的plt.hist(values,bins ='auto',ec ='k')。

#1


1  

That's the new default style for matplotlib 2.0 (for example, see the plots from the documentation for plt.hist in v2.0).

这是matplotlib 2.0的新默认样式(例如,请参阅v2.0中plt.hist文档中的图表)。

To force the edges of the bins to be displayed you can pass the edgecolor= (or ec=) argument to plt.hist, e.g. plt.hist(values, bins='auto', ec='k') for black bin edges.

要强制显示bin的边缘,可以将edgecolor =(或ec =)参数传递给plt.hist,例如黑色bin边缘的plt.hist(values,bins ='auto',ec ='k')。