편집 기록

편집 기록
  • 프로필 noah0508님의 편집
    날짜2021.03.26

    RuntimeError: The animation function must return a sequence of Artist objects.


    def animate(i):
        """The main animation function, called for each frame."""
        def animate_particle(X, ln, i):
            """Plot the trajectory of a particle up to step i."""
            ln.set_data(X[:i,0], X[:i,1])
            ln.set_3d_properties(X[:i,2])
            particles._offsets3d = np.vstack((Xe[i][:3], Xi[i][:3])).T
        animate_particle(Xe, lne, i)
        animate_particle(Xi, lni, i)
    
    fig, ax, lne, lni, particles = init()
    ani = animation.FuncAnimation(fig, animate, init_func=init, frames=5000, interval=1000, blit=True)
    
    HTML(ani.to_html5_video())
    
    rc('animation', html='html5')
    ani
    
    
    plt.show()
    

    아마 animate 함수에 return을 추가하지 않아서 돌아가지 않는것 같습니다... 어떻게 return을 추가해야할지 감이 안옵니다.

    출처는 https://nbviewer.jupyter.org/github/scipython/plasma-projects/blob/master/gyromotion/Gyromotion.ipynb 입니다.

  • 프로필 nowp님의 편집
    날짜2021.03.26

    Python RuntimeError: The animation function must return a sequence of Artist objects.


    def animate(i):
        """The main animation function, called for each frame."""
        def animate_particle(X, ln, i):
            """Plot the trajectory of a particle up to step i."""
            ln.set_data(X[:i,0], X[:i,1])
            ln.set_3d_properties(X[:i,2])
            particles._offsets3d = np.vstack((Xe[i][:3], Xi[i][:3])).T
        animate_particle(Xe, lne, i)
        animate_particle(Xi, lni, i)
    
    fig, ax, lne, lni, particles = init()
    ani = animation.FuncAnimation(fig, animate, init_func=init, frames=5000, interval=1000, blit=True)
    
    HTML(ani.to_html5_video())
    
    rc('animation', html='html5')
    ani
    
    
    plt.show()
    

    아마 animate 함수에 return을 추가하지 않아서 돌아가지 않는것 같습니다. 어떻게 return을 추가해야할지 감이 안옵니다.

    출처는 https://nbviewer.jupyter.org/github/scipython/plasma-projects/blob/master/gyromotion/Gyromotion.ipynb 입니다.

  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.03.26

    RuntimeError: The animation function must return a sequence of Artist objects.


    def animate(i): """The main animation function, called for each frame.""" def animate_particle(X, ln, i): """Plot the trajectory of a particle up to step i.""" ln.set_data(X[:i,0], X[:i,1]) ln.set_3d_properties(X[:i,2]) particles._offsets3d = np.vstack((Xe[i][:3], Xi[i][:3])).T animate_particle(Xe, lne, i) animate_particle(Xi, lni, i)

    fig, ax, lne, lni, particles = init() ani = animation.FuncAnimation(fig, animate, init_func=init, frames=5000, interval=1000, blit=True)

    HTML(ani.to_html5_video())

    rc('animation', html='html5') ani

    plt.show()

    아마 animate 함수에 return을 추가하지 않아서 돌아가지 않는것 같습니다... 어떻게 return을 추가해야할지 감이 안옵니다.

    출처는 https://nbviewer.jupyter.org/github/scipython/plasma-projects/blob/master/gyromotion/Gyromotion.ipynb 입니다.