Chinaunix首页 | 论坛 | 博客
  • 博客访问: 466151
  • 博文数量: 65
  • 博客积分: 2645
  • 博客等级: 少校
  • 技术积分: 675
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-08 17:04
文章分类

全部博文(65)

文章存档

2010年(5)

2009年(5)

2008年(14)

2007年(35)

2006年(6)

分类: Python/Ruby

2008-05-22 22:28:02

大学时,我们使用Matlab画数学图形.
matplotlib 模块也提供了类似的功能.
matplotlib下载地址: 
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()



阅读(3250) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~