You are here: System » GnuPlotPlugin

GnuPlotPlugin

Allows users to plot data and functions using GnuPlot

Gnuplot is a portable graphing utility. It was originally created to allow scientists and students to visualize mathematical functions and data interactively, but has grown to support many non-interactive uses such as web scripting. It is also used as a plotting engine by third-party applications like Octave. Gnuplot has been supported and under active development since 1986.

See the full documentation of gnuplot itself at http://www.gnuplot.info/documentation.html

Syntax Rules

Images are generated using the %GNUPLOT{<parameters>}% macro. It can either read the plot script from a named section or from a plot script attached to a topic.

Parameter Description Default
"..." name of section in mode="section"; name of attachment in mode="attachment"  
mode="attachment|section" specifies the mode of operation attachment
attachtopic="..." name of the topic where to attach the output of gnuplot current topic
topic="..." name of a topic to read a section (or attachment) from current topic
type="gif|jpeg|png|svg" terminal and file type being generated; note that not all terminal types of gnuplot make sense online png
width="<integer>" width of the image being generated 640
height="<integer>" height of the image being generated 480
size="<integer>x<integer>|dynamic|fixed" geometry of the image being generated; values dynamic and fixed only make sense for type="svg" $width x $height
format="..." format string to render the output image <img src='$url' class='gnuPlotImage' id='gnuplot$name' alt='$name' width='$width' height='$height' />
The format string may use the following variables:

  • $url: url to the image file being created
  • $web: web name where the image has been created
  • $topic: topic name where the image has been attached
  • $file: file name of the image
  • $name: name of the source image
  • $width: width of the image being created
  • $height: height

In addition to the normal gnuplot syntax for plot scripts, they might contain Foswiki makros which are expanded in the context of the topic specified. To reference data files attached to a plot script the variables %ATTACHDIR% and %PUBDIR% are supported to properly determine the location of those.

For example below "Damped Sinus" script looks like this:
set title "Damped Sinus"
set nokey
set xlabel "X Axis Label"
set ylabel "Y Axis Label"
plot '%ATTACHDIR%/DampedSinus.data'

Examples

The following images are examples of plots generated by GnuPlot:

Simple function test

TestInstall

Multi graphs with errorbars, datafile based

MultigraphWithErrorbars

Damped sinus, datafile based

DampedSinus

DampedSinus

Map of Denmark, datafile based (data from CIA World Data Bank II)

CIAWorldDataBankIIDenmark

Interlocking Tori (3D)

InterlockingTori

Blue Whale (3D), datafile based

BlueWhale

Alternative GnuPlot render sizes, Rosenbrock Function

RosenbrockFunction

Installation

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Dependencies

None

Change History

11 Jul 2016: added attachtopic and format parameters (Foswiki:Main.MichaelDaum)
30 Apr 2014: rewrite (Foswiki:Main.MichaelDaum)
30 Apr 2006: Added sandbox security mechanism (Foswiki:Main.SteffenPoulsen)
19 Apr 2006: Fixed anchors, added 3D examples, added png size option (Foswiki:Main.SteffenPoulsen)
17 Apr 2006: Doc update, changed working dir to ATTACHURLPATH (Foswiki:Main.SteffenPoulsen)
27 Jan 2006: Initial version

Sitemap

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback