如何在matplotlib中创建堆叠的对数比例条形图

时间:2014-04-01 20:05:05

标签: python matplotlib plot

我试图实现一个堆积的条形图,该条形图的日志比例为y,我遇到了一些麻烦。

我可以通过以下形式的命令生成堆积条形图:

plt.bar(x,y1, width=widths,yerr=y1err)

plt.bar(x,y2, width=widths,yerr=y2err, bottom=y1)

我可以通过以下命令生成日志条形图:

plt.bar(x,y1, width=widths,yerr=y1err, log=True)

plt.yscale('log', nonposy='clip')

然而,当我把两者放在一起创建堆叠的日志条形图时:

plt.bar(x,y1, width=widths,yerr=y1err, log=True)

plt.bar(x,y2, width=widths,yerr=y2err, bottom=y1, log=True)

plt.yscale('log', nonposy='clip')

它返回一个常规的日志条形图,而不是堆积的日志条形图。好像"底部"参数被忽略了。此外,一些酒吧随意丢失(可能暗示不稳定/通话中的错误)。

对此问题的任何见解?

干杯,

SR

0 个答案:

没有答案