Pandas Bar Chart

Tanguy Bretagne

I have just moved to pandas 0.20 / matplotlib 2.0 python 3.6. (form the version below in all). I've used pandas to plot bar charts because matplotlib was always too low level. The behaviour of colouring columns has now changed and I don't know how to fix that. It used to be the following:

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)

producing:

Old Version

But now the chart produces:

New Version

So that the first color is picked up but not the rest.

Wondering if it's a bug or a new methodology, though I can't find a correct reference.

Scott Boston

Pass color as a list:

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related