[IPOL discuss] 2D curves script

Miguel Colom Miguel.Colom at cmla.ens-cachan.fr
Wed May 25 12:19:56 CEST 2011

Hello everybody,
a first script to draw 2D curves is finished and available to everybody in
the dev. (fuchsia) server to everybody at

Everybody has execution rights on this file, so please don't copy it to
your application directory. Instead, just reference it. Only one copy of
the script should exist.

First of all, I'll explain the data format for the curves.
It's quite simple. It consists on a plain text file with several lines.
Each line contains a set of numbers separated by white spaces. Each line
has N numbers. The first N/2 are the values of the X coordinates of
everypoint. The second N/2 are the Y-coordinates.

For example, if a line contains 96.373337  25.533333  60.693333  3.130140 
4.123497  3.806937 it means that three points must be drawn: (96.373337,
3.130140), (25.533333, 4.123497) and (60.693333, 3.806937). All lines have
to contain the same amount of points.

This format is compatible with GNUPlot, although there were added some
- It's possible to add comments: just put a # sign before the comment line.
- It's possible to add empty lines. They'll be ignored.
- It's possible to add heading and trailing spaces to the lines.

The script accepts the name of the text file with the point coordinates as
a parameter and it also accept some options:

  --output=OUTPUT    output PNG file
  --title=TITLE      title
  --xName=XNAME      X-axis name
  --yName=YNAME      Y-axis name
  --x0=X0            X-axis first value
  --x1=X1            X-axis last value
  --y0=Y0            Y-axis first value
  --y1=Y1            Y-axis last value
  --legend=LEGEND    Legend for each data channel
  --grid=GRID        use grid
  --markers=MARKERS  use markers

If the legend is specified, it will draw a leyend for each curve. It has
to be a list of names separated by commas. For example:

No option is mandatory. They'll take its default value if they aren't
To avoid the grid being show, the option is --grid=0. Otherwise, it will
be shown.
To avoid the markers being show, the option is --markers=0. Otherwise, it
will be shown.

There's a sample data file in the script directory to test it.
The data format has been restricted to PNG in order to keep maintenance of
the scripts easy.


More information about the discuss mailing list