- 论坛徽章:
- 0
|
大学时,我们使用Matlab画数学图形.
matplotlib 模块也提供了类似的功能.
matplotlib下载地址: http://matplotlib.sourceforge.net/tutorial.html
matplotlib 依赖 numpy.
下面是我画图的代码.
#!/usr/bin/env python
#coding=GBK
import pylab
import math
a = range(0, 360+1) #度数
x = map(lambda x:math.pi*x/180.0, a)
#y = map(lambda x:math.sin(x*math.pi/180.0), a)
y = map(lambda x:math.sin(x), x)
pylab.plot(x,y)
pylab.title('y = sin(x)')
pylab.xlabel('x')
pylab.ylabel('y')
pylab.show()
![]()
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/10686/showart_699791.html |
|