SET_VIEWPORT Procedure
Standard Library procedure that establishes a new position for the rectangular plot area based on input values specified using the normalized coordinate system.
Usage
SET_VIEWPORT, xmin, xmax[, ymin, ymax]
Input Parameters
xmin—The position of the left edge of the rectangular plot area in normal coordinates.
xmax—The position of the right edge of the rectangular plot area in normal coordinates.
ymin—(optional) The position of the bottom edge of the rectangular plot area in normal coordinates.
ymax—(optional) The position of the top edge of the rectangular plot area in normal coordinates.
Keywords
Cursor—Lets you set the region for the rectangular plot area interactively with the mouse:
If nonzero, lets you set the boundaries by clicking the mouse at the corners of the rectangular plot area that you want to use. Click first to set the lower-left corner, then once again to set the upper-right corner. Any input parameters for SET_VIEWPORT are ignored.
If zero, uses the input parameters as specified.
Region—If present, uses the system variable !P.Region to set the plot area. The default is to use !P.Position.
Discussion
SET_VIEWPORT is used to set up the area of the display that will be used for plotting. It is identical to the SET_SCREEN procedure, except that the input parameters are in normalized coordinates for SET_VIEWPORT.
If only xmin and xmax are provided, the values for ymin and ymax are calculated. Calling SET_VIEWPORT with four input parameters is the same as setting the !P.Postion system variable or using the Position keyword with the plotting commands.
SET_VIEWPORT overrides the effect of the system variables !X.Margin and !Y.Margin.
Example
SET_VIEWPORT, .2, .5
PLOT, [3, 5, 2]
SET_VIEWPORT, .1, .45, .55, .90
PLOT, [3, 4, 5], Title='Upper left plot'
SET_VIEWPORT, .1, .45, .1, .45
PLOT, [5, 1, 6], Title='Lower left plot', /Noerase
SET_VIEWPORT, .55, .90, .55, .90
PLOT, [3, 4, 5], Title='Upper right plot', /Noerase
SET_VIEWPORT, .55, .90, .1, .45
PLOT, [2, 4, 3], Title='Lower right plot', /Noerase
SET_VIEWPORT, 1, 1, 1, 1, /Cursor
; Click the mouse button on the lower left corner of the desired
; plotting area and then again for the desired upper right corner.
PLOT, [3, 5, 4]
SET_VIEWPORT, .2, .8, .2, .8
PLOT, [3, 4, 5], Title='Without setting the region keyword'
SET_VIEWPORT, .2, .8, .2, .8, /Region
PLOT, [3, 4, 5], Title='With the region keyword set', /Noerase
See Also
System Variables:
!P.Position,
!P.Region