python使用matplotlib绘图 -- barChart
        matplotlib  是python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地进行制图。而且也可以方便地将它作为绘图控件,嵌入GUI应用程序中。它的文档相当完备,并且  </span> Gallery页面  中有上百幅缩略图,打开之后都有源程序。因此如果你需要绘制某种类型的图,只需要在这个页面中浏览/复制/粘贴一下,基本上都能搞定。  -----引用自: http://hyry.dip.jp/pydoc/matplotlib_intro.html          你可以从 http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib 下载安装matplotlib。         这篇我们用matplotlib从构造最简单的bar一步一步向复杂的bar前行。什么是最简单的bar,看如下语句你就知道她有多么简单了:
  
  plt.bar(left = 0,height = 1) 
  plt.show()  
   
  
  plt.bar(left = ( 0, 1),height = ( 1, 0. 5)) 
  plt.show()  
  
  
  plt.bar(left = ( 0, 1),height = ( 1, 0. 5),width = 0. 35) 
  plt.show()  
 
  
  plt.xlabel(u '性别') 
  plt.ylabel(u '人数') 
  plt.bar(left = ( 0, 1),height = ( 1, 0. 5),width = 0. 35) 
  plt.show()  
 
  
  plt.xlabel(u '性别') 
  plt.ylabel(u '人数') 
  
  plt.xticks(( 0, 1),(u '男',u '女')) 
  
  plt.bar(left = ( 0, 1),height = ( 1, 0. 5),width = 0. 35) 
  
  plt.show()  
 
  
  plt.xlabel(u '性别') 
  plt.ylabel(u '人数') 
  
  plt.xticks(( 0, 1),(u '男',u '女')) 
  
  plt.bar(left = ( 0, 1),height = ( 1, 0. 5),width = 0. 35,align = "center") 
  
  plt.show()  
  
 
  
  plt.xlabel(u '性别') 
  plt.ylabel(u '人数') 
  
  
  plt.title(u "性别比例分析") 
  plt.xticks(( 0, 1),(u '男',u '女')) 
  rect = plt.bar(left = ( 0, 1),height = ( 1, 0. 5),width = 0. 35,align = "center") 
  
  plt.legend((rect,),(u "图例",)) 
  
  plt.show()  
 
       for rect in rects : 
          height = rect.get_height() 
          plt.text(rect.get_x() +rect.get_width() / 2., 1. 03 *height, '%s' % float(height)) 
  
  def autolabel(rects) : 
       for rect in rects : 
          height = rect.get_height() 
          plt.text(rect.get_x() +rect.get_width() / 2., 1. 03 *height, '%s' % float(height)) 
  
  plt.xlabel(u '性别') 
  plt.ylabel(u '人数') 
  
  
  plt.title(u "性别比例分析") 
  plt.xticks(( 0, 1),(u '男',u '女')) 
  rect = plt.bar(left = ( 0, 1),height = ( 1, 0. 5),width = 0. 35,align = "center") 
  
  plt.legend((rect,),(u "图例",)) 
  autolabel(rect) 
  
  plt.show()  
 
  rect = plt.bar(left = ( 0, 1),height = ( 1, 0. 5),width = 0. 35,align = "center",yerr = 0. 000001) </div>    