Contents Previous Next Subchapters Current Chapters-> gplot gplotstyle gplotlevels glevel ginit gstyle gprint gcopy gsave gcolor gaddwin gaddwin1 gaddwin2 gaddwin3 gaddwin4 gwin glistwin gaddview setview gview gview2 glistview ginitview gdelview gaddborder gdelborder gborder gupdate Parent Chapters-> Omatrix6 graphics basicGraphics gaddview Search Tools-> contents reference index search

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

Description
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.

Example
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 ```      ginit      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.