2017-12-28 23 views
-1

棒グラフの各棒の色を変更する際に問題があります 「Administrative &サポートスタッフ」、「その他」を別のものに変更したい色の助け.. 私の現在のコードがあるmatplotlibの棒グラフ(python)で複数の棒の色を変更/設定する方法

import seaborn as sns 
sns.set() 

ax1 = tt.plot(kind='bar', figsize=(20,10), fontsize=13) 
#legend = plt.legend(loc=2, fontsize=8) 
for tick in ax1.get_xticklabels(): 
    tick.set_rotation(0) 

ax1.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05), 
      fancybox=True, shadow=True, ncol=5) 
# ax1 = plt.gca() 
# leg = ax1.get_legend() 
# leg.legendHandles[1].set_color('yellow') 

plt.show() 

output image

答えて

0
import seaborn as sns 
sns.set() 

ax1 = tt.plot(kind='bar', figsize=(20,10), fontsize=13, color = ['#1b9e77', '#a9f971', '#fdaa48']) 

for tick in ax1.get_xticklabels(): 
    tick.set_rotation(0) 

ax1.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05), 
      fancybox=True, shadow=True, ncol=5) 


plt.show() 

はそれを

を得ました