(转)使用 python Matplotlib 库绘图

时间:2022-04-15 21:44:24

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

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

(转)使用 python Matplotlib 库绘图

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

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文件头部加上如下内容:

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