DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dataplot

Dataplot Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes

plugin Plot tabular data using Gnuplot

Last updated on
2020-07-30
Provides
Syntax
Repository
Source

Similar to ditaa, graphviz

Tagged with data, images, media, plot, science

This plugin creates plot images from tabular text data using the Gnuplot program. It supports exporting to OpenOffice through the ODT Plugin. The underlying philosophy of Dataplot is to remain simple and minimalistic, thus offering a very small subset of Gnuplot's numerous features based on typical use cases. Its purpose is to offer a quick way to visualize tabular data on a wiki page. Feel free to develop your own plugin for more complicated scopes.

For more information on Gnuplot refer to the Gnuplot documentation.

This plugin is largely inspired from the Graphviz plugin by Andreas Gohr. The main difference between the two plugins is that, in the present case, the code executed by Gnuplot is generated by the plugin, instead of being provided as input.

Download and Installation

:!: External requirements: This plugin requires the following additional components that must be installed separately:

Pre-built packages fulfilling these conditions exist for most Linux distributions.

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Latest changes

Configuration

The full path to your Gnuplot binary must be configured in the config manager. By default, the plugin uses /usr/bin/gnuplot for the path. The images are then generated using the pngcairo terminal of Gnuplot, which is why you must use a version of Gnuplot built with Cairo support.

Examples/Usage

The most basic usage of Dataplot is for plotting a simple curve to visualize 2-column tabular data. This reads as follows:

<dataplot>
0.0 0.0
1.0 1.0
2.0 4.0
3.0 9.0
</dataplot>

With this syntax, all parameters are set to their defaults: Gnuplot's default size for the pngcairo terminal, i.e. 640×480 by the time this document is written, no smoothing of the curves, and drawing curves with linespoints.

Here is another typical example of the use of this plugin for 2D plots, for multiple curves. The first column is always the horizontal coordinate, while each additional column represents an independent curve.

<dataplot center linespoints smooth 600x400>
0.0 0.0  1.0    25.0 2 
1.0 1.0  10.5    20.0 4
2.0 4.0  8.25   15.0 5
3.0 9.0  4.125  10.0 9
4.0 16.0 12.065  5.0  18
5.0 25.0 5.0325 0.0  23
</dataplot>

In this example, Gnuplot is asked to plot 3 curves with smooth lines within a 600×400 image which will be centered horizontally on the wiki page.

Syntax

The dataplot tag and its options controls the plot parameters. Everything enclosed within a

<dataplot>...</dataplot>

environment is interpreted as input data for Gnuplot and is supposed to be ordered column-wise. By providing keywords along with the dataplot tag in any order, the plot can be tweaked to a certain extent.

The default line style of the plot is linespoints. The available options are boxes, lines, linespoints, and points.

The smooth keyword will smooth the curves with csplines. The default is to draw straight lines between data points.

You can also specify left, center or right to align the resulting image. The default is left.

A parameter in the form of <number>x<number> is interpreted as wanted output size. To only specify width width=<number> or <number>x0 can be used, for height height=<number> or 0x<number>.

The plot axes can be labelled by using the xlabel=“text and ylabel=“text options. Please note that the labels must be double-quoted to be taken into account.

You may also specify ranges for the plot through the xrange=a:b and yrange=c:d options. Please note that all interval borders must be specified as floating-point numbers to be taken into account. For example, xrange=-1.0:1.0 will indeed affect the plot X-axis, while xrange=-1:1 will be silently ignored.

Configuration and Settings

The only configurable parameter of this plugin is the path to the Gnuplot binary, which defaults to /usr/bin/gnuplot and can be changed through the config manager.

Known Bugs and Issues

ToDo/Wish List

Here are the desirable features planned for the next versions of this plugin:

  • read several independent (X,Y) datasets as pairs of columns;
  • allow for parametric plots;
  • allow for 3D plots.

You can ask for more features by submitting bugs to the Launchpad Project Page for Dataplot.

FAQ

Why Gnuplot and not another plotting program?

Gnuplot is an element of choice to render images on a wiki, both because of its versatility and its very high scriptability. They give the plugin a lot of flexibility and adaptability, which is a clear advantage when the needs of users constantly change with time.

Why using ''pngcairo'' instead of the more basic ''png'' terminal of Gnuplot?

The pngcairo terminal provides a significantly better rendering quality than the png one, as well as a dashed option which is very useful to generate print-quality black-and-white documents and for color-blind people. The improvement of the user experience and the extension to a larger audience is really worth the little burden a webmaster may have to go through when installing the plugin.

Why not letting the user directly provide a Gnuplot script?

Since Gnuplot can execute arbitrary shell commands, this would create a very high security risk for the server. This is why the plugin generates the Gnuplot script from a strictly controlled subset of Gnuplot commands.

Discussion

Not yet. Feel free to start one.

plugin/dataplot.txt · Last modified: 2020-07-30 20:31 by pouillon

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki