0

I ve got the following code,

makeprice=df1.groupby(['CarMake']).price.agg(['mean'])

makeprice.plot.bar()
plt.xlabel('Car Make')
plt.ylabel('Price')
plt.title("Mean Car Prices")
plt.show()

I ve tried cmap, but for some reason it gives me empty chart, when listing all colours i.e. color=['black','red...] it would only take first one.

Also is there any way to change the name of the legend bar to something else?

  • 2
    [Does this](https://stackoverflow.com/a/18903963/8881141) answer your question? – Mr. T Oct 25 '20 at 14:29
  • I am still not sure, how can I implement such array of colours into my example for some reason it just takes first colour from the set. – Aleksander Bielinski Oct 28 '20 at 20:09
  • And I am still not sure what the problem is. What part of `makeprice.plot.bar(color=["red", "blue", "yellow"])` does not work (if you have three bars, that is)? A sample dataset would help to tell us what exactly the problem is you encounter. Maybe you have a complicated [multi-index dataframe structure](https://stackoverflow.com/q/64550318/8881141) that we are not aware of? We don't know. – Mr. T Oct 28 '20 at 20:26

0 Answers0