我有一个用python画海龟螺旋(从内到外)的作业,但我想不出一个方法来做,除了我所做的事情外,它需要这样:
我试着那样做,但它不能正常工作。
import turtle
turtle.shape ('turtle')
d = 20 #Distance
a = 1 #StartingAngle
x = 200 #Num of loops
for i in range (x):
turtle.left(a)
turtle.forward(d)
a = a + 5
我是一个python初学者,试图用matplotlib.pyplot库在一幅图上画一堆点和一条线。下面是一些示例代码
import matplotlib.pyplot as plt
import numpy as np
x1,x2,n,m,b = -50.,150.,11,0.,0.
x = np.r_[x1:x2:n*1j]
for list in points:
plt.plot(list[0], list[1], 'rs')
plt.axis([ -50, 150, -50, 150])
plt.plot(x, m*x + b)
plt.show
我正试着用咖啡豆画我的网。net是用expt/expt.prototxt定义的,所需的图像路径是expt/net.png。当我运行命令./python/draw_net.py expt/expt.prototxt expt/net.png时,会得到以下错误:
Couldn't import dot_parser, loading of dot files will not be possible.
Drawing net to expt/net.png
Traceback (most recent call last):
File "./python/draw_net.py