python中matplotlib所绘制的图包含了很多的对象

 

上图中的top=‘off’意思是说顶部的grid lines 看不见。

 

 去除frame,意思就是将这个矩形给去除掉,spine意思是脊柱

 

bars = plt.bar(pos, popularity, align='center', linewidth=2, color='lightslategrey')
bars[0].set_color('#1F77B4')

这两句命令,可以看出bars是包含5个变量。

颜色的深浅可以用alpha变量进行调节。

 

plt.gca().text(bar.get_x() + bar.get_width()/2, bar.get_height() - 5, str(int(bar.get_height())) + '%',
ha='center', color='w', fontsize=11)

这个为插入文本命令

原文地址:https://www.cnblogs.com/shadow1/p/10431602.html