带有散射

时间:2015-11-14 20:16:21

标签: python animation matplotlib rotation

我正在为学校做一个项目,我必须在蟒蛇上为一群鱼做动画。每条鱼都是一个列表[x, y, angle]。我有一个功能,可以一次性更新学校(鱼类列表)。

我想为学校制作动画。

到目前为止,我提出的解决方案有点简陋,

# Function draw shoaling fishes
def representer_banc (B) :
    for i in range(0,N):                   #the angle of the fish
        plt.scatter(B[i][0],B[i][1],s=600,marker=(3,0,B[i][2]),alpha=0.5)
        plt.scatter(B[i][0],B[i][1],s=600,marker=(2,0,B[i][2]))
    plt.show()

#évolution du banc de t à t+k*dt
def nage(Banc,temps):
    representer_banc(Banc)
    plt.clf()
    for t in range(0,temps+1):
        Banc=avancer_banc(Banc) #updates the school
        representer_banc(Banc)
        plt.pause(0.01)     #I would like to improve this part
        plt.clf()

我还没有找到任何可以更新散点标记角度的动画。到目前为止,动画有点滞后,你能帮帮我吗?

0 个答案:

没有答案
相关问题