How to change bar colors individually in matplotlib?

Asked

Viewed 1,022 times

0

Hello! Can anyone explain to me how the principle works to change the colors of the bars individually? All I can do is change the color of the whole chart.

For example: From Blue to Black / From Orange to Gray / From Green to Red

If you can help me, I’d be very grateful. att,

df3 = df_interest.iloc[[0,1,2,3,4],:3]

df3.plot(kind='bar', figsize=(20,8), width=0.8)
plt.title("Percentage of Respondents' Interest in Data Science Areas")

inserir a descrição da imagem aqui

  • Do not just pass the parameter color for the function .plot(), with a list of color RGB values? Something like color = ['#000000','#AAAAAA','#FF0000'].

  • That’s right! Thank you very much! SOLVED!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.