参考:http://blog.csdn.net/flyfish1986/article/details/54426965
----------------------------------------------
效果
import numpy as np
import matplotlib.pyplot as plt
#直线
x1=np.arange(-20, 20, 1)
x2=(3*x1-12)/2
plt.plot(x1,x2)
#直线
y1=np.arange(-20, 20, 1)
y2=1-2*y1
plt.plot(y1,y2)
#抛物线 y=3x^2+x+4
x=np.arange(-20, 20, 1)
y=3*(x**2)+x+4
plt.plot(x,y)
plt.show()
----------------------------------------------
代码
http://blog.csdn.net/Tuzi294/article/details/78198833
------------------------------
参考:
效果:
代码
import turtle
def drawCircle(color,radix):
turtle.color(color) #设置画笔颜色
turtle.circle(radix) #画圈,半径为50
if __name__ == '__main__':
radix = 50
pensize = 5
fd = 4 / 5 * radix #forward distance
color = ["black","yellow","blue","green","purple"]
turtle.pensize(pensize)
for x in range(5):
drawCircle(color[x],radix)
turtle.up() #提起画笔,不作画
turtle.forward(fd) #向前移动
turtle.down() #下放画笔,准备作画