2
df=pd.DataFrame([770,215,179,107,83,82,70,60,57,54,52],index = ['A','B','C','D','E','F','G','H','I','J','K'])
ax = df.plot(kind='bar',stacked = False,alpha=0.75, rot=45,fontsize=20)
ax.legend_.remove()
for p in ax.patches:
ax.annotate(np.round(p.get_height(),decimals=0).astype(np.int64), (p.get_x()+p.get_width()/2., p.get_height()), ha='center', va='center', xytext=(2, 10), textcoords='offset points',fontsize=20)
plt.ylabel('y ',fontsize=25)
plt.title('x',fontsize=30)
plt.show()
plt.save()
plt.close()
遞給我:着色只在matplotlib barplot某條不同顏色的
現在,我只想彩色B和H用不同的顏色可以說,紅色和橙色。我會非常感激任何建議來實現這一目標。謝謝。
謝謝maxu ..做的目的:) –
@Aceraceae,很高興我能幫助:) – MaxU