在使用NumPy进行学习统计计算时是枯燥的,大量的数据令我们很头疼,所以我们需要把它图形化显示。 
Matplotlib是一个Python的图形框架,类似于MATLAB和R语言。

Matplotlib的官网地址是 http://matplotlib.org/ ,下载地址为 http://matplotlib.org/downloads.html,选择对应的版本即可安装,我选择的版本为matplotlib-1.3.1.win32-py2.7.exe

由于我之前已经安装过NumPy1.8,所以安装Matplotlib后只需要安装 dateutil 和 pyparsing,win32的安装文件可以在这里找到 http://www.lfd.uci.edu/~gohlke/pythonlibs/

所有配套组件都安装成功后如果执行 import matplotlib.pyplot as plt 出错,请参考这篇文章http://blog.csdn.net/yang6464158/article/details/18546871#comments 
    安装  scipy,然后把C:\Python27\Lib\site-packages\scipy\lib中的six.py six.pyc six.pyo三个文件拷贝到C:\Python27\Lib\site-packages目录下。

import numpy as np
import matplotlib.pyplot as plt N = 5
menMeans = (20, 35, 30, 35, 27)
menStd = (2, 3, 4, 1, 2) ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars fig, ax = plt.subplots()
rects1 = ax.bar(ind, menMeans, width, color='r', yerr=menStd) womenMeans = (25, 32, 34, 20, 25)
womenStd = (3, 5, 2, 3, 3)
rects2 = ax.bar(ind+width, womenMeans, width, color='y', yerr=womenStd) # add some
ax.set_ylabel('Scores')
ax.set_title('Scores by group and gender')
ax.set_xticks(ind+width)
ax.set_xticklabels( ('G1', 'G2', 'G3', 'G4', 'G5') ) ax.legend( (rects1[0], rects2[0]), ('Men', 'Women') ) def autolabel(rects):
# attach some text labels
for rect in rects:
height = rect.get_height()
ax.text(rect.get_x()+rect.get_width()/2., 1.05*height, '%d'%int(height),
ha='center', va='bottom') autolabel(rects1)
autolabel(rects2) plt.show()

运行上面代码,执行后如下图所示。

来自:http://my.oschina.net/bery/blog/203595

Python-Matplotlib安装及简单使用的更多相关文章

  1. python gdal安装与简单使用

    原文链接:python gdal安装与简单使用 gdal安装方式一:在网址 https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal 下载对应python版本的 ...

  2. Python之路-python环境安装和简单的语法使用

    一.环境安装 Win10(安装python3.x): 1.下载安装包     https://www.python.org/downloads/   2.安装完成后设置环境变量. 桌面-“计算机”-右 ...

  3. Python+Selenium安装及环境配置

    一.Python安装 Window系统下,python的安装很简单.访问python.org/download,下载最新版本,安装过程与其他windows软件类似.记得下载后设置path环境变量,然后 ...

  4. 可视化数据matplotlib之安装与简单折线图

    matplotlib是一个可视化数据的模块,安装前需要先安装Visual Studio Community:然后去https://pypi.python.org/pypi上查找matplotlib并下 ...

  5. 安装python Matplotlib 库

    转:使用 python Matplotlib 库 绘图 及 相关问题  使用 python Matplotlib 库绘图      转:http://blog.csdn.net/daniel_ustc ...

  6. (转)python requests的安装与简单运用

    requests是python的一个HTTP客户端库,跟urllib,urllib2类似,那为什么要用requests而不用urllib2呢?官方文档中是这样说明的: python的标准库urllib ...

  7. python requests的安装与简单运用

    requests是python的一个HTTP客户端库,跟urllib,urllib2类似,那为什么要用requests而不用urllib2呢?官方文档中是这样说明的: python的标准库urllib ...

  8. [Python]Pip的安装以及简单的使用

    Pip的安装 安装python以后(我的python版本是32位,版本号2.7.10),如果需要安装一些其他的库,一般有两种办法,一种是自己手动去各个库的官网下载,自己安装:另一种方法是安装pip,使 ...

  9. python操作三大主流数据库(7)python操作mongodb数据库①mongodb的安装和简单使用

    python操作mongodb数据库①mongodb的安装和简单使用 参考文档:中文版:http://www.mongoing.com/docs/crud.html英文版:https://docs.m ...

  10. python web py安装与简单使用

    web.py是一个轻量级的python web框架,简单而且功能强大.相对flask和Django,web.py更适合初学者来学习和了解web开发的基础知识.   安装: pip install we ...

随机推荐

  1. MYSQL入门(三)

    索引简介 索引是对数据库表中一个或多个列(例如,employee 表的姓名 (name) 列)的值进行排序的结构.如果想按特定职员的姓来查找他或她,则与在表中搜索所有的行相比,索引有助于更快地获取信息 ...

  2. css3实现手机效果的“切换标签”

    Style样式 .toggle { position: relative; display: inline-block; width: 60px; height: 30px; border: 1px ...

  3. 我总结的js方面你可能不是特别清楚的小知识

    !!将一个值方便快速转化为布尔值 console.log( !!window===true ); 不声明第三个变量实现交换 var a=1,b=2; a=[b,b=a][0];//执行完这句代码之后 ...

  4. HDU1024Max Sum Plus Plus(M段最大和)

    题意:求一个数组中 M 段的 最大和 没看明白怎么搞得 抽空来看,写的不赖 #include <iostream> #include <cstring> #include &l ...

  5. easyUI创建dialog弹框

    1.在当前页面必须有一个DIV <!-- 保证金明细的详情列表显示 --> <div id="dialog-alarm-detail"></div&g ...

  6. StringBuilder 和 StringBuffer

    这两者唯一的不同就在于,StringBuffer是线程安全的,而StringBuilder不是.当然线程安全是有成本的,影响性能,而字符串对象及操作,大部分情况下,没有线程安全的问题,适合使用Stri ...

  7. texlive2015+texstudio

    编译器 texlive2015 编辑器 texstudio

  8. BaKoMa Tex Word 的使用

    数学论文编排软件,付费,但是可以这么处理,安装好后不要马上打开,进入影子系统的时候再运行它,这样每次都是全新的, 优势是 WYSIWYG,所见即所得, 中文输入, \documentclass{art ...

  9. 国内GIT托管服务

    http://www.cnblogs.com/TianFang/p/3348949.html

  10. Linux--文件查找命令

    一.简介查找文件的几个命令: 1.which :查找可执行文件的位置 2.whereis:查找文件的位置,可以找到可执行命令和man page 3.locate:配合数据库查看文件位置 4.find: ...