I am using PLplot with PlCairo and GTK, the whole program being coded in Ocaml and thus using Ocaml bindings.

My question actually has two steps:
*How to modify dynamically the size of a figure ?
*How to update a figure with different values (remove the curve(s) with the old values and then write new ones) ?

First question:
The example (http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/examples/ocaml/xgtk_interface.ml?view=markup) uses a scale mechanism which just scale the figure to the new size. This is a problem in the case where the size of the figure changes, and then, the figure appears either too small or too big inside the window.
I wanted to redraw the figure each time the size of the window changes (eg.: on an expose event on a drawing area in GTK).
I first tried to create a new Cairo context and Plplot stream through plinit_cairo and then draw my curves with the usual functions (plcol0, plwid, plline) each time the window changes of size but it creates an empty window from the beginning.
I also tried to clear the graph by using plclear and then, write again on it with some plplot commands, but is not working.

Second interrogation, how can I erase and then write into a PLplot stream.
I tried to use to the timer from GTK to launch a function that will interact with the PLplot stream (plclear and then functions to draw), but it's not working, the graph stays the same.

I don't know the internal mechanisms used by plplot, so maybe, in both cases, it is impossible to do what I just explained.

Thanks in advance for your time.

Johan Mazel