我想从我的直方图中删除竖线轮廓,但保留直方图的“ eclipse 刻”,如果可以的话。
import matplotlib.pyplot as plt
import numpy as np
bins = 35
fig = plt.figure(figsize=(7,6))
ax = fig.add_subplot(111)
ax.hist(subVel_Hydro1, bins=bins, facecolor='none',
edgecolor='black', label = 'Pecuiliar Vel')
ax.set_xlabel('$v_{_{B|A}} $ [$km\ s^{-1}$]', fontsize = 16)
ax.set_ylabel(r'$P\ (r_{_{B|A}} )$', fontsize = 16)
ax.legend(frameon=False)
给予
这在 matplotlibs 直方图功能中可行吗?我希望我提供了足够的清晰度。
最佳答案
在 pyplot.hist()
中,您可以设置 histtype = 'step'
的值。示例代码:
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
x = np.random.normal(0,1,size=1000)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.hist(x, bins=50, histtype = 'step', fill = None)
plt.show()
示例输出:
关于Python - 从直方图中删除垂直条线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39372470/