PublishPlot Icon

  PublishPlot

Creating high-quality plots for publications

Averaging Multiple Curves

Description

When reporting experimental results, it is important to report statistical variations in results by calculating terms such as standard deviation. Most methods for calculating such quantities, however, assume you have multiple replicates of an experiment with each replicate being a single value. What should one do when the experimental results are curves instead of single values? The two scripts on this page provide two options for averaging multiple plots and generating an average curve complete with error bars.

Script Downloads

Script Name Installation Steps Date
Average Curves
  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 "Average Curves.applescript" in the folder you linked to the "Scripts" menu in PublishPlot.
1 Apr 2023
Combine Curves Same as above, but save as "Combine Curves.applescript". 1 Apr 2023

Using "Average Curves" Script

To use this script, open a PublishPlot document with two or more curves and choose "Average Curves" from the "Scripts" menu. You will be asked to provide a number of intervals for the averaging. Pick a number, which should depend on length of the curves and the density of points within each curve. You want each interval to have multiple points. Click OK and the averaging will proceed as follows:

  1. All data points from all curves will be partitioned into the number of equally-spaced boxes you selected.
  2. The means and standard deviation of data in each box will be calculated.
  3. A new plot will be added with a line through the mean values and error bars equal to the standard deviations.

Using "Combine Curves" Script

This script achieves a similar result to "Average Curves," but by a different approach. To use it, open a PublishPlot document with two or more curves and choose "Combine Curves" from the "Scripts" menu. No user input is needed and the averaging is done as follows:

  1. All data points in all curves are combined into a single new curve.
  2. The combined curve is plotted with mean values and standard deviations by using the statistics options of PublishPlot. The new curve will initially be set to calculate means and standard deviations using statistics "Tolerance" set to 1/10 the range of the data. You can also switch to box & whisker plots if you prefer.

Once the script is done, you can alter the averaging intervals by changing the "Tolerance" setting in the inspector window for the new plot. Increase the tolerance to get fewer error bars or decrease it for more.

An advantage of the "Combine Curves" script over the "Average Curve" script is that the combined plot contains all data points and therefore all information from the original curves. You can change intervals (through tolerance) or combine with more data sets as they become available. In contrast, output of the "Average Curves" script is a snap shot of the current curves with a fixed number of intervals. If you want to change the number of intervals or include a new data set, you have to start over with the averaging process.