Contents Previous Next Subchapters

Using Location To Switch Between Graphic Viewports
Syntax gview(rightup)
See Also gview , gaddview , glistview , gwin
Menu Command Graphics | Viewport | Select/Clear/Delete . . . | (Select)

Description
Sets the current viewport to the smallest one that contains the relative coordinates (right, up) with in the current graphics window. The return value is the right, up, width, and height, which were used to create the viewport, as a four-column real row vector.

Example
The following program titles each of two viewports and then waits for you select one using the mouse. When you use the mouse button to select one of the viewports, the program generates a plot in the viewport that you selected.

clear
begin
     text = {"Use the mouse", "to select a viewport"}
     id   = gaddtext(text, [.5, 1.], [.5, 1.])
     gaddview(.25, 0., .5, .4);
          gaddborder
     gtitle("Viewport 1")
     gaddview(.25, .4, .5, .4);
     gaddborder
     gtitle("Viewport 2")
     gupdate
     ru = gcoord
     gview(ru(1), ru(2))
     gplot(seq(5))
end