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
Error: Exception 410: NoImagesDefined `Resize' @ error/Q16HDRI.xs/XS_Image__Magick__Q16HDRI_Mogrify/7840
Multi graphs with errorbars, datafile based
Error: Exception 410: NoImagesDefined `Resize' @ error/Q16HDRI.xs/XS_Image__Magick__Q16HDRI_Mogrify/7840
Map of Denmark, datafile based (data from CIA World Data Bank II)
Error: Exception 410: NoImagesDefined `Resize' @ error/Q16HDRI.xs/XS_Image__Magick__Q16HDRI_Mogrify/7840
Interlocking Tori (3D)
Blue Whale (3D), datafile based
Alternative GnuPlot render sizes, Rosenbrock Function
Error: Exception 410: NoImagesDefined `Resize' @ error/Q16HDRI.xs/XS_Image__Magick__Q16HDRI_Mogrify/7840
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