在使用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. AngularJs $location 和 $window

    $location $location服务解析浏览器地址中的url(基于window.location)并且使url在应用程序中可用.将地址栏中的网址的变化反映到$location服务和$locati ...

  2. Linux命令(31):zip/unzip命令-打包压缩

    zip命令功能说明    zip程序即是文件压缩工具也是文件归档工具,可以对文件或者目录进行压缩或解压,压缩格式为zip.在Linux系统中,gzip才是主要的压缩指令,而bzip2仅次之.Linux ...

  3. Node-webkit简介

    Node-webkit 概述 Node-webkit 是Github 上一个非常热门的开源项目,它基于著名的浏览器开源项目 Chromium 和服务器端 JavaScript 实现 Node.js 的 ...

  4. 深入JVM-锁与并发

    一.锁在Java虚拟机中的实现与优化 1.1 偏向锁 偏向锁是JDK 1.6 提出的一种锁优化方式.其核心思想是,如果程序没有竞争,则取消之前已经取得锁的线程同步操作.也就说,若某一锁被线程获取后,便 ...

  5. ServiceStack.Text 更快的序列化

    Json.net 是以前最经常用的序列化组件,后来又注意到ServiceStack号称最快的,所以我做了以下测试 1)Json.net using System; using System.Colle ...

  6. UDP 网络通信 C#

    接收端   using System; using System.Net; using System.Net.Sockets; using System.Text; using System.Thre ...

  7. Numerical Optimization: Understanding L-BFGS

    http://aria42.com/blog/2014/12/understanding-lbfgs/ Numerical optimization is at the core of much of ...

  8. Unity时钟定时器插件

    Unity时钟定时器插件 http://dsqiu.iteye.com/blog/2020603https://github.com/joserocha3/KillerCircles/blob/67a ...

  9. RHEL-界面中文乱码问题

    一.虚拟机里的rhel更换为中文简体后,中文字符变为小方块 二.解决方法: 安装中文支持的软件包 fonts-chinese-3.02-12.el5.noarch.rpm fonts-ISO8859- ...

  10. Linux环境下常用软件(个人笔记编辑更改中)

    近期使用CentOS,就在这里记录一下.首先,个人版本是CentOS6.5,属于centos系列,Fedora系列的理论上也可以用. 工欲善其事,必先利其器,这里介绍我的软件包配置: 1.vim(增强 ...