[英]Matplotlib Histogram with no lines between the bars
Using plt.hist()
, you need to create the histogram using the argument histtype="stepfilled"
and set the edgecolor
of the patches, which is by default set to None, in order to get the histogram the way you desire: 使用
plt.hist()
,您需要使用参数histtype="stepfilled"
创建直方图并设置色块的edgecolor
(默认情况下设置为None),以便以所需的方式获取直方图:
import numpy as np
import matplotlib.pyplot as plt
data = np.random.randn(10000)
plt.hist(data, histtype="stepfilled", edgecolor='k', linewidth=1.2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.