[IPOL discuss] ipol_demo, matplotlib and other modules [ Re: Noise estimation ready in dev. server ]

Miguel Colom Miguel.Colom at cmla.ens-cachan.fr
Thu Apr 28 19:46:05 CEST 2011

> So from a maintenance point of view, it is best if demos either
> implement plotting themselves using a simple "draw_line" function, or
> if more plotting power is needed, to use a stable library like GNU
> plotutils (http://www.gnu.org/software/plotutils/).
> Nicolas and Jose-Luis have already written a function using PIL to
> render histogram plots.  It is also manageable to implement a
> "draw_line" function in about 100 lines of C, so basic 2D plots are
> also possible in C without special libraries.

We can write C code to write simple figures, but I still think that
there's no maintenance problem on using matplotlib.

If the problem is that we're afraid of its API being changed, we can offer
a proxy API or some programs to interface with. Of course, the editors can
choose to not using them and just write their C code.

For example, I wrote a simple Python script that creates PNG figures for
the noise estimation demo.
You can call it from the command line:
noiseCurve.py <data.txt> <figure.png> [title] [x0] [x1] [y0] [y1]

It takes a file with data (GNUPlot format), the name of the figure, a
title and the limits of the data to show and generates it's output.

We could write some simple scripts like this and make them available to
all users (read and execute access, but not writeable).
For example:
- Write curves by a list of points in GNUplot format.
- Vector fields.
- Histograms.
- 3D plots.
- Etc.

In the case matplotlib or the library below changes, we just adapt those
few programs and all the demos will work again.

There's no maintenance overflow at all in doing this and it would make
easy and fast to create more demos.

More information about the discuss mailing list