Skip to contents

Renders one PNG frame per observed time point on the modified MDS configuration: each attribute is drawn at \(\bm{y}_j(t)\) with symbol size proportional to the smoothed occurrence \(f_j(t)\), class colours, and a fading trail of the class centroids over the previous trail frames.

Usage

ljmds.animate(
  x,
  file = "ljmds_animation.gif",
  trail = 7,
  fps = 2,
  class.col = grDevices::palette.colors(8, "Classic Tableau"),
  frame.dir = NULL
)

Arguments

x

An object returned by ljmds.pipeline().

file

Output GIF path (used only when magick is available).

trail

Number of trailing frames for the centroid trail.

fps

Frames per second of the GIF.

class.col

Optional colour palette for the classes. Defaults to grDevices::palette.colors(8, "Classic Tableau"), recycled if k exceeds its length.

frame.dir

Optional directory in which to write the per-frame PNGs. If NULL (default) and magick is available, a temporary directory is used and removed after the GIF has been written; if magick is not available, a fresh directory ljmds_frames is created in the current working directory and kept (so the frames are not lost).

Value

Invisibly, the GIF file path when magick is available, otherwise the directory containing the per-frame PNGs.

Details

Frame generation uses only base R graphics, so it works in a minimal install. When the magick package is available the per-time PNGs are additionally assembled into a GIF animation; otherwise the GIF assembly step is skipped (with a message) and the frames are kept on disk so the user can assemble the GIF later by another tool.

See also

ljmds.pipeline() which produces the input object, plot.ljmds() for the static counterparts of the animation.