Ross Demtschyna
Ross Demtschyna

Reputation: 333

Set the color of each bar in groups of 3

My dataframe has an index with dates and they are in groups of 3. I would like to have Bar 1 to use green, next bar would be red and the next yellow. Then repeat for the next group of three and I just want the date and not the time.

fig, ax = plt.subplots(figsize=(10,5))
df_merged_dates['Percent_move'].plot(kind='bar', color= 'r')
plt.show()

screen shot of bar chart

Upvotes: 1

Views: 112

Answers (1)

Serenity
Serenity

Reputation: 36635

Do you try:

df_merged_dates['Percent_move'].plot(kind='bar', color=['green','red', 'yellow'])

Upvotes: 1

Related Questions