animate

do_mpc.graphics.animate(graphics, fig, n_steps=None, export_path='./', export_name='animation', overwrite=False, format='gif', fps=5, writer=None)[source]

Animation helper function.

Call this function with a configured Graphics instance and the respective figure. This function will export an animation with the results from the do_mpc.data.Data object.

Either specify format and fps or supply a configured writer (e.g. ImageMagickWriter for gifs).

Parameters:
  • graphics (Graphics) – Configured Graphics instance.
  • fig (Matplotlib Figure.) – Matplotlib Figure.
  • n_steps (int) – (Optional) number of time steps for the animation.
  • export_path (str) – (Optional) Path where to export the animation. Directory will be created if it doesn’t exist.
  • export_name (str) – (Optional) Name of the resulting animation (gif/mp4) file.
  • overwrite (bool) – (Optional) Check if export_name already exists in the supplied directory and overwrite or alter export_name.
  • format (str) – (Optional) Choose between gif or mp4.
  • fps (int) – (Optional) Frames per second for the resulting animation.
  • writer (writer class) – (Optional) If supplied, the fps and format argument are discarded. Use this to configure your own writer.
Returns:

None