Skip to content

FuncAnimation Named Arguments #20326

@Zeyuzhao

Description

@Zeyuzhao

Problem

I would like to use named arguments in FuncAnimation.

Currently:

ani = matplotlib.animation.FuncAnimation(
  fig, update, frames=len(raw_history),
  interval=500, repeat=True, repeat_delay=1,
  fargs=(raw_history, action_history, style)
)

This would be slightly cumbersome when I change the order / type of arguments my function accepts. I could use functools to attach named parameters to the function update, but it would be nice if FuncAnimation can support this feature.

Proposed Solution

ani = matplotlib.animation.FuncAnimation(
  fig, update, frames=len(raw_history),
  interval=500, repeat=True, repeat_delay=1,
  fkwargs={'raw_history': raw_history, 'action_history': action_history, 'style': style}
)

We keep the fargs parameter, but we also add an fkwargs for keyword parameters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy