什么是使用drawow函数的正确方法

时间:2019-11-12 14:39:35

标签: python

我正在尝试使用drawnow()模拟旋转的轮子。我使用函数draw_wheel

spokes = 3
angle = np.pi

def draw_wheel(spokes, angle):

wheel_width = 3
spoke_width = 3

# Draw outer circle. Wrapping around twice removes
# some endpoint drawing issues.
n = 200
t = np.linspace(0, n, num=n+1)
t = np.concatenate((t, t)) * 2*np.pi / n
plt.plot(np.cos(t), np.sin(t), 'k', linewidth=wheel_width)

spoke_angle = 2*np.pi / spokes

for i in range(1, spokes + 1):
    x = np.concatenate(
            (np.array([0]),
            np.array([np.cos(angle+(i-1)*spoke_angle)])), axis=0
        )
    y = np.concatenate(
            (np.array([0]),
            np.array([-np.sin(angle+(i-1)*spoke_angle)])), axis=0
        )
    plt.plot(x,y,'k', linewidth=spoke_width)

return 1

但是当我尝试将其提供给drawnow()时,我得到了一个错误:

  

'int'对象不可调用

有什么建议吗?

0 个答案:

没有答案