我无法更改条形图中每个条形图的颜色,我想将“管理和支持人员”,“其他”更改为不同的颜色帮助..我当前的代码是
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()
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()
得到它了