Contents Previous Next Subchapters

Creating A New Viewport In The Current Graphic Window
Syntax gaddview(rightupwidthheight)
See Also gview , glistview , ginitview , gborder
Menu Command Graphics | Add Viewport . . .

Creates a plotting viewport of the size specified by width and height at the position specified by right and up, where right, up, width, and height are real or double-precision scalars. The function also returns a scalar integer that is the identifier of the new viewport. The position (right, up) and the size (width, height) are in relative coordinates within the current plotting window.

The initial viewport is the entire "Graphic 0" window. The values right and up specify the location of the lower-left corner of the viewport as a fraction of the entire window (relative to the lower-left corner of the window). The values width and height specify the size of the viewport as a fraction of the entire window. To plot the line y = x in the upper-right quadrant of the window, enter
     x       = 0. : .1 : 1.
     upright = gaddview(.5, .5, .5, .5);
     gplot(x, x)
You could continue the example above to include a plot of the parabola y = x^2 in the lower-left quadrant of the display by entering
     lowleft = gaddview(0., 0., .5, .5)
     gplot(x, x^2)
The resulting plot would look like this:

To add another viewport to the upper-left quadrant of the window, you could enter
     upleft = gaddview(0., .5, .5, .5)
If you then enter
     print upright, lowleft, upleft
O-Matrix will reply
     1 2 3
which are the corresponding viewport identifiers.