Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
If you want your graphics to be redrawn at the right size when the window is resized you must follow these steps:
A simple example that demonstrates this is as follows:
x := -pi + 2 * pi * [0:100] / 100; # -pi -> pi y := sin (x); f := frame (); pg := pgplot (f); draw := function() { pg->env (-pi, pi, -1, 1, 0, 1); pg->line (x, y); } draw(); # Initial plot whenever f->resize do { draw(); # Redraw at the current size }
Note that if you call the pap function, the size in pixels of the plot surface will be fixed until you call pap again. At present there is no way to entirely undo the pap call, however you can get the current width and height of the plot surface with the nonstandard width() and height() methods of the pgplot agent, and use those in calls to pap in your redraw logi. Generally, however, it is best to avoid calling pap at all.