Python绘图——Matplotlib 库绘图的安装步骤
2014-03-16 10:45
786 查看
1.Matplotlib的安装
matplotlib 是python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地进行制图。Matplotlib的安装可以参见 官网链接 http://matplotlib.org/users/installing.html
下面总结步骤如下:
windows 平台上 下载.exe格式 直接安装。
1,python下载安装 下载地址。
2,安装你所需要版本(这个要根据步骤1的python版本)的Matplotlib,下载地址。
下面安装Matplotlib 依赖的库
3, 对于标准版的Python来说,要使用Matplotlib,还需要安装numpy模块,其下载地址,或者这里。
4, msvcp71.dll, 在某些系统上,你可能还需要下载msvcp71.dll库。下载
这个档案,解压后把它拖到c:\windows\system32目录中。
5, 运行一个简单的程序例子:
[python] view
plaincopy
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.ylabel('some numbers')
plt.show()
2安装过程遇到的错误
发现出现了下面的错误:raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires dateutil
这个需要dateutil,你可以到这里下载安装。
把dateutil 安装完后又出现如下错误:
raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing
需要 pyparsing 到这里下载安装。
完成以上步骤,运行上面的例子就可以显示我们的图像,如下所示。
在程序安装过程中如果遇到需要安装的一些依赖包,你可以到这里查找(点我),确实是个好资源。
可以根据所画图形的需要 在下面的链接里选择相应的图形 进行修改,绘出自己所需的图像。
example: http://matplotlib.org/examples/index.html, gallery:http://matplotlib.org/gallery.html
相关资源链接:
Matplotlib Tutorial 中文翻译的 http://reverland.org/python/2012/09/07/matplotlib-tutorial/ 。
用Python做科学计算 http://sebug.net/paper/books/scipydoc/index.html 。
资源下载:
如果上面不能下载。我把安装 python matplotlib所需的软件放到百度网盘了,可以到这里这下。3中文乱码解决方法
注意绘图时中文的解决方法, 在.py文件头部加上如下内容:# -*- coding: utf-8 -*-
from pylab import *
mpl.rcParams['font.sans-serif'] = ['SimHei'] #指定默认字体
mpl.rcParams['axes.unicode_minus'] = False #解决保存图像是负号'-'显示为方块的问题
4绘图脚本.py转为 .exe
如果为希望能把Python脚本发布为脱离Python平台运行的可执行程序,比如单个的exe文件。可以参考这篇博文:http://blog.csdn.net/daniel_ustc/article/details/15501385
转自:http://blog.csdn.net/daniel_ustc/article/details/9714163
相关文章推荐
- Python的机器学习库scikit-learn、绘图库Matplotlib的安装
- windows下python绘图库matplotlib安装方法(亲测)
- python绘图库Matplotlib的安装
- 用 python绘图及网络分析(win64下matplotlib,networkx安装方法)
- python使用matplotlib 以及matplotlib安装绘图(window7)
- python绘图工具matplotlib在linux下安装和使用
- 安装python Matplotlib 库绘图工具流程
- Python3.6.4安装matplotlib步骤
- python绘图库Matplotlib的安装
- 在python3.3中使用matplotlib的安装方式
- python matplotlib阶段性总结——word转txt、绘图、文件操作
- 使用 python Matplotlib 库绘图
- python数据分析之(6)简单绘图matplotlib.pyplot
- Windows下python安装matplotlib
- python+matplotlib绘图线条类型、颜色、散点类型
- 使用 python Matplotlib 库绘图
- Python安装matplotlib所需要的软件以及问题的解决方法
- Python--matplotlib绘图可视化知识点整理
- Python中的Numpy,Scipy和matplotlib的安装
- python matplotlib绘图时图例显示问题