Python 绘制阶梯直方图,但不使用底线闭合多边形

Python 绘制阶梯直方图,但不使用底线闭合多边形,python,matplotlib,Python,Matplotlib,如何删除关闭阶梯直方图路径的底线 import numpy as np import matplotlib.pyplot as plt mu, sigma = 100, 15 x = mu + sigma * np.random.randn(10000) fig = plt.figure() ax = fig.add_subplot(111) n, bins, patches = ax.hist(x, 50, normed=1, histtype='step') plt.ylim(-.005,

如何删除关闭阶梯直方图路径的底线

import numpy as np
import matplotlib.pyplot as plt

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)
fig = plt.figure()
ax = fig.add_subplot(111)
n, bins, patches = ax.hist(x, 50, normed=1, histtype='step')
plt.ylim(-.005, plt.ylim()[1])
plt.show()

更新:已报告,现已修复:


最简单的方法是自己绘制:

import numpy as np
import matplotlib.pyplot as plt

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)
fig = plt.figure()
ax = fig.add_subplot(111)
bins, edges = np.histogram(x, 50, normed=1)
ax.step(edges[:-1], bins, where='post')
plt.ylim(-.005, plt.ylim()[1])
plt.show()
查看或了解
where=post
。您需要将最后一个条目从边缘切掉,因为直方图返回
[左边缘0,左边缘1,…,左边缘(n-1),右边缘(n-1)]
(请参见 )


这被视为一种回归,并将在至少1.3中固定。相关PR:

我没有得到使用mpl 1.1.0的这条线路的好处。我也没有。我现在用的是头,看到了线。谢谢,效果很好!MPL DEVS是否考虑添加一个选项来关闭PyPr.HIST中的底线?正如上面提到的@tom10,这是以前的行为。@我们最近在直方图上做了大量工作,这可能是一种回归。我怀疑这是添加填充阶梯图工作的结果。您应该在github上创建一个问题。