samedi 31 juillet 2021

Several conditions and color change matplotlib and pandas df

I need to plot a barchat and to apply a color according to the "Attribute" column of my dataframe

enter image description here

x axis = Shares
y axis = Price

fig, ax = plt.subplots()
ax.barh(df['Share'],df['Price'], align='center')
ax.set_xlabel('Shares')
ax.set_ylabel('Price')
ax.set_title('Bar Chart & Colors')
plt.show()

Thanks for your help !

Aucun commentaire:

Enregistrer un commentaire