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

[Doc]: Surprising behavior of FuncAnimation example in the first frames #29856

Open
@bluthej

Description

@bluthej

Documentation Link

https://matplotlib.org/devdocs/users/explain/animations/animations.html#funcanimation

Problem

When looking carefully at the first few frames of the animation from theFuncAnimation example by settinginterval=2_000 for instance, there are some surprises:

  • First, a single point is plotted, corresponding to the initial scatter plot
  • Then this point disappears, corresponding to the first frame which is empty becauseframe=0 and we take slices (x = t[:frame],y = z[:frame])
  • Then the point reappears, and in the following frames the trajectory is plotted as expected

I think the expected behavior is that the first point appears, and then the trajectory starts, which can be obtained by replacingframes=40 withframes=range(2, 40).

Side point

That does raise another related point which I encountered and which is what led me to look at that example, which is that saving the animation to a file and showing it in an interactive window behave differently with respect to the first frame. The initial state of the plot is shown in interactive mode but does not show up in the saved GIF. In theFuncAnimation example, when saving the animation to a GIF, the first frame doesn't have any point, then the point appears and the trajectory then proceeds normally (so it's like I described above but without the first frame).

My understanding is this comes from the fact that the animation does not have access to the initial figure setup, but I might be wrong. This "inconsistency" is a little sad for me because in order to have the first frame show up in the GIF I have to accept the fact that it's shown twice in interactive mode.

Shall I open another issue about this?

Suggested improvement

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp