Python——使用matplotlib创建条形图1,基本条形图首先是matplotlib (http://matplotlib.org/API/py plot _ API.html # ) 安装matplotlib.py plot.plot-coding : utf-8-- importmatplotlib.pyplotaspltnum _ list=[ 1.5,0.6,7.8,6 ] num_list(PLT.show ) 2、设定颜色#-- *-coding : utf-8-- importmatplotlib.pyplotaspltnum _ list=[ 1.5,0.6,
#-- coding : utf-8-- importmatplotlib.pyplotaspltnum _ list=[ 1.5,0.6,7.8,6 ] PLT.bar (range (len ) ) )
3、标签#-*-coding 3360 utf-8-*-importmatplotlib.pyplotaspltname _ list=[ ' Monday ',' Tuesday ',' Friday tick_label=name_list(PLT.show ) 4、堆叠条形图#-- *-coding : utf-8-- importmatplotlib.pyplotaspltname _ 8 3,1 ] PLT.bar (range (len (num _ list ) ) ) ) num_list1,bottom=num_list,label='girl ',tirl ) fc='r'(PLT.legend ) ) plt.show ) 5、条形图#-- *-coding : utf-8-*-importmatplotlib.pyplotaspltname 2,3,1 ] x=list (range (len ) num_list ) ) num_list,width=width,label='boy ',fc='y ) forinrangrang
6、条形图#-*-coding 3360 utf-8-*-importmatplotlib.pyplotaspltname _ list=[ ' Monday ',' Tuesday ',' Friday