Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Hints Up: Glish/PGPLOT Previous: Pgplot Agent Constructor

Pgplot and Window Resizing

If you want your graphics to be redrawn at the right size when the window is resized you must follow these steps:

1.
Capture the resize event from the outermost frame. (Only the outermost frame emits these events).
2.
Redraw your graphics.

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.


next up previous contents index
Next: Hints Up: Glish/PGPLOT Previous: Pgplot Agent Constructor   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15