熊猫条形图

时间:2017-07-24 14:42:32

标签: python python-3.x pandas matplotlib

我刚刚搬到了pandas 0.20 / matplotlib 2.0 python 3.6。 (总共形成以下版本)。 我已经使用熊猫来绘制条形图,因为matplotlib总是太低了。 着色列的行为现在已经改变,我不知道如何解决这个问题。 它曾经是以下:

np.random.seed(42)
d = pd.Series(data=np.random.rand(10), index=range(10))
color=np.random.rand(10,4)

d.plot.bar(color=color)
制造

Old Version

但现在图表产生:

New Version

这样就可以拾取第一种颜色而不是其他颜色。

想知道它是否是一个错误或新的方法,但我找不到正确的参考。

1 个答案:

答案 0 :(得分:5)

将颜色作为列表传递:

np.random.seed(42)
d = pd.Series(data=np.random.rand(10), index=range(10))
color=np.random.rand(10,4)

d.plot.bar(color=[color])

enter image description here

相关问题