Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FuncAnimation w/o init_func breaks when saving #5399

Closed
Assignees
jenshnielsen
Milestone
@cbreeden

Description

@cbreeden

I was trying to work out a patch to#5335 and ran into issues introduced in merge#4800. The following code is slightly simplified example from the animations examples:

%matplotlib nbaggimport matplotlibimport matplotlib.pyplot as pltimport matplotlib.animation as animationimport numpy as npdef update_line(num, data, line):    line.set_data(data[...,:num])    return line,fig = plt.figure()plt.xlim(0, 1)plt.ylim(0, 1)data = np.random.rand(2, 10)l, = plt.plot([], [], 'r-')ani = animation.FuncAnimation(fig, update_line, 10, fargs=(data, l),                                                   interval=50, blit=True)ani.save('im.gif', writer='imagemagick')

running this yields:

im 1

The animation displays correctly in the notebook. The issue is introduced here

foraniminall_anim:
. WhenFuncAnimation._init_draw() is called, if noinit_func is given, the first frame sequence is appended toself._save_seq. After which,
fordatainzip(*[a.new_saved_frame_seq()
is executed andFuncAnimation.new_saved_seq() then only returns the first drawn frame for which to iterate over. The end result is an animation file with only one frame.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp