postgkyl.animate

postgkyl.animate(data, *, use=None, collected=False, squeeze=False, subplots=False, num_subplot_row=None, num_subplot_col=None, transpose=False, contour=False, clevels=None, quiver=False, streamline=False, sdensity=1.0, arrowstyle=None, group=None, scatter=False, markersize=None, linewidth=None, linestyle=None, color=None, style=None, diverging=False, arg=None, fixaspect=False, logx=False, logy=False, logz=False, xshift=0.0, xscale=1.0, yshift=0.0, yscale=1.0, zshift=0.0, zscale=1.0, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, xlim=None, ylim=None, zlim=None, no_legend=False, no_colorbar=False, forcelegend=False, xlabel=None, ylabel=None, clabel=None, title=None, edgecolors=None, no_showgrid=False, hashtag=False, multiblock=False, grouptags=False, interval=100, variable_range=False, cutoffglobalrange=None, notitle=False, no_show=False, save=False, saveas=None, fps=None, codec=None, dpi=None, saveframes=None, figsize=None, nproc=1, tmpdir=None)

Animate a sequence of frames, one frame per dataset (or dataset group).

Each panel uses its own value range across all frames. Datasets overlaid in a panel share that range; explicit bounds override the computed limits.

Parameters:
  • data – a flat iterable of datasets (each becomes a single-dataset frame), or an iterable of frames where each frame is itself a list of datasets drawn together (overlaid, as in matplotlib.plot).

  • use – Select datasets with this tag.

  • collected – Treat the leading axis of each dataset as time.

  • squeeze – Draw all components in one panel.

  • subplots – Draw each dataset in a separate block of panels.

  • num_subplot_row – Number of subplot rows.

  • num_subplot_col – Number of subplot columns.

  • transpose – Transpose the display axes.

  • contour – Draw contours.

  • clevels – Contour count or start:end:count levels.

  • quiver – Draw vector arrows.

  • streamline – Draw streamlines.

  • sdensity – Streamline density.

  • arrowstyle – Streamline arrow style.

  • group – Draw lineouts along coordinate 0 or 1.

  • scatter – Draw point markers without connecting lines.

  • markersize – Marker size in points.

  • linewidth – Line width.

  • linestyle – Matplotlib line style.

  • color – Line or vector color.

  • style – Matplotlib style name or file.

  • diverging – Use a diverging colormap.

  • arg – Matplotlib format string, for example *--.

  • fixaspect – Use equal scaling on the display axes.

  • logx – Use logarithmic x scaling.

  • logy – Use logarithmic y scaling.

  • logz – Use logarithmic z scaling.

  • xshift – X shift, applied before scaling.

  • xscale – X scale factor.

  • yshift – Y shift, applied before scaling.

  • yscale – Y scale factor.

  • zshift – Z shift, applied before scaling.

  • zscale – Z scale factor.

  • xmin – X minimum limit.

  • xmax – X maximum limit.

  • ymin – Y minimum limit.

  • ymax – Y maximum limit.

  • zmin – Z minimum limit.

  • zmax – Z maximum limit.

  • xlim – X limits as a pair or comma-separated string; overrides individual bounds.

  • ylim – Y limits as a pair or comma-separated string; overrides individual bounds.

  • zlim – Z limits as a pair or comma-separated string; overrides individual bounds.

  • no_legend – Suppress legends.

  • no_colorbar – Suppress colorbars.

  • forcelegend – Show a legend even for one curve.

  • xlabel – Override the x label.

  • ylabel – Override the y label.

  • clabel – Override the c label.

  • title – Title shown on every frame.

  • edgecolors – Mesh cell edge color.

  • no_showgrid – Suppress grid lines.

  • hashtag – Display the Postgkyl hashtag.

  • multiblock – Force datasets with the same frame index into one frame.

  • grouptags – Build a separate animation for each dataset tag.

  • interval – live-animation delay between frames, in milliseconds.

  • variable_range – Recompute each panel’s value/color scale for every frame instead of holding it constant across the animation.

  • cutoffglobalrange – clip the fixed range to this central percentile band (see _frame_value_range); None uses the true min/max.

  • notitle – suppress the per-frame frame/time title.

  • no_show – Do not open a live window (the FuncAnimation path only).

  • save – write to saveas (or anim.gif) after building the frames.

  • saveas – output path; its extension selects the writer (.gif/ .webp/.apng via PIL, .mp4/.mov/.avi/.mkv via ffmpeg).

  • fps – frames per second for the saved movie; defaults from interval.

  • codec – Video encoder name, such as libx264 or mpeg4. By default, prefer software H.264, then MPEG-4. Checked before frame generation.

  • dpi – resolution for saved frames/movies.

  • saveframes – when given, write <saveframes>_<i>.png for every frame instead of building a live FuncAnimation.

  • figsize – figure size in inches, forwarded to matplotlib.plot.

  • nproc – parallel worker processes for frame generation (saveframes, or the tmpdir-backed compile path below); 1 renders sequentially in-process.

  • tmpdir – directory for the temporary frame directory used when nproc is greater than 1 and saveframes is not given (frames are written there, compiled into the output, then discarded).

Returns:

The list of written frame paths when saveframes is set; otherwise the FuncAnimation (keep a reference – Matplotlib does not keep the live animation alive for you). When nproc renders through the tmpdir compile path, or when saving WebP/APNG without saveframes, the compiled output path is returned instead. With grouptags, returns one result per tag.

Raises:
  • ValueError – no datasets to animate, or an unsupported saveas extension.

  • RuntimeError – saving to a video container without ffmpeg on PATH.

CLI: animate