I finally found how do to do everything that I was looking for on this
email.
I'll just simply join the example to this mail, for if it interests anybody,
they would have access. This example is heavily based on the xgtk_interface
example. I simply remove the plot of map and my own picked from the example
x01 from the examples on the PLplot website.

In order to demonstrate the possible reactualization of the plot, I simply
used a GTK timer that rewrite the curve and add some random noise each 2
seconds.

If you see any problem, or wrong use of PLplot in my code, please, signal
them to me.

Regards.
Johan


2010/9/17 Johan Mazel <[email protected]>

> Hi
> 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.
>
> Regards.
> Johan Mazel
>

Attachment: graph.ml
Description: Binary data

Attachment: main.ml
Description: Binary data

Attachment: Makefile
Description: Binary data

Attachment: utils.ml
Description: Binary data

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to