PublishPlot Icon

  PublishPlot

Creating high-quality plots for publications

Create Animations with PublishPlot

Description

PublishPlot's main goal is to create plots for print or on-line publications. Once your work is accepted and published, however, you might be invited to present the results of that publication at a conference. It is possible your talk would be enhanced by using plot animations. This help topic demonstrates one method for creating plot movies in PublishPlot.

Script Downloads

Script Name Installation Steps Date
Animate Spiral
  1. Click on script name to open source code in a new tab or window
  2. Choose "Save Page As..." (or equivalent) menu command
  3. Save as "Animate Spiral.applescript" in the folder you linked to the "Scripts" menu in PublishPlot.
4 Apr 2021

Using the "Animate Spiral" Script

To try an animation, choose "Animate Spiral" from the "Scripts" menu. You can edit the script in Apple's Script Editor to change features of the plot or to pick a location for saving plot frames. See comments in the script for details. This script is just a demonstration of plot animation in PublishPlot using a script. See the next section for how it works and how you can create your own animations.

Plot Animation Strategy

A plot movie is a series of frames where each frame has a plot with slightly different data. Once created, these frames are stiched together into a movie file using various movie creation software tools (such as the free Fiji). Creating a series of images is best automated using a script. The logic of that script (or any movie script) is as follows:

  1. Create a data set to be plotted as an animation in two lists of values (e.g., xpts and ypts).
  2. Start a plot with the first two points using a plot table data command and start two new lists with those first two points (e.g., xdraw and ydraw).
  3. Loop over all points in xpts and ypts and add them one at a time to xdraw and ydraw.
  4. After adding some number of points, set the plot data of the plotted data set started in step 2 to the growing xdraw and ydraw. This set will cause the plot to redraw. For good visual experience, delay the script after plotting each frame.
  5. To create images to be stitched into a movie, each time you change the plot data, export the plot to a PDF file using the export pdf command. Note that due to restrictions Apple places on writing files, you must export to the "Pictures" folder of your home directory (it can be any subfolder in that folder). To help with movie-making software, the files should have similar names but end in a number that is incremented for each frame.
  6. To create a movie, import the exported PDF files to movie-making software.

To create your own and different animations, you can copy the "Animate Spiral" script and then change the code related to plotting a spiral to new code plotting the data you want to animate. Most other parts of the script (such as choosing frame frame length, frame rate, and exporting plot frames) will remain about the same.