(转)使用 python Matplotlib 库绘图

运行一个简单的程序例子:

1 import matplotlib.pyplot as plt  
2 plt.plot([1,2,3])  
3 plt.ylabel('some numbers')  
4 plt.show()  

可以根据所画图形的需要 在下面的链接里选择相应的图形 进行修改,绘出自己所需的图像。

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 。

中文乱码解决方法

注意绘图时中文的解决方法, 在.py文件头部加上如下内容:

1 # -*- coding: utf-8 -*-   
2 from pylab import *  
3 mpl.rcParams['font.sans-serif'] = ['SimHei'] #指定默认字体  
4 mpl.rcParams['axes.unicode_minus'] = False #解决保存图像是负号'-'显示为方块的问题 

 

posted @ 2016-09-21 10:42  老牛一逼了  阅读(1699)  评论(0编辑  收藏  举报