The following system variables control various IDL Direct Graphics functions. These system variables are structures that contain many tags. For example, the command
!P.TITLE = 'Cross Section'
sets the default plot title.
Many of the functions of the graphics keywords described in Graphics Keywords, are also controlled by the system variables
You can change the default style of plots, fonts, etc., by setting the corresponding field in the appropriate system variable. Also, some effects that persist longer than one call are controlled only by system variables. The field
The cursor system variable. Currently, the only function of this system variable is to contain the subscript of the largest or smallest element found by the MAX and MIN functions. That information is better obtained through the optional output arguments to those routines. !C is included only for compatibility with old versions of IDL.
This system variable is a structure that contains information about the current graphics output device (or window, on a windowing system). Fields, in alphabetical order, are:
The line interval, in device coordinates, required to obtain a solid fill.
A longword of flags that provide information about the current device. Each bit is a flag encoded as shown in the following table.
To test whether a particular bit is set on your system, use an IDL command like the following:
IF(!D.FLAGS AND value) NE 0 THEN PRINT, 'Bit is set.'
where value is the value associated with the bit you wish to examine. For example, to check whether the device supports color, use:
IF(!D.FLAGS AND 16) NE 0 THEN PRINT, 'Bit is set.'
The number of allowed color values. In the case of devices with windows, this field is set after the window system is initialized. For a monochrome system,
A string containing the name of the device.
A two-element integer array containing the current pan/scroll offset. An offset of (0, 0) is normal. Positive offsets shift the display memory to the right and upwards. This field has relevance only with devices with hardware pan and scroll abilities.
The number of color table indices.
| Note |
The logical number of the file open for output by the current graphics device. This field only has meaning for devices that write to a file if the file is accessible to the user from IDL, and is 0 if no file is open.
For example, the PostScript driver fills this field with the unit number of the file open for PostScript output. In the case of Tektronix output to a file,
The index of the currently open window. This field is set to -1 if no window is currently open. This field is used only with devices that support windows.
The width and height of the rectangle that encloses the "average" character in the current font, in device units (usually pixels).
These values describe the size of the rectangle that contains the "average" character in the current font. (It is not important what the "average" character is; it is used only to calculate a scaling factor that will be applied to all of the characters in the font.) The first element specifies the width of the rectangle in device units (usually pixels), and the second element specifies the height.
For vector and TrueType fonts, the height of the "average" character is determined by the width of the rectangle. The aspect ratio of the "average" character remains fixed; the character is scaled so that its width is the value of X_CH_SIZE. The resulting scale factor is then applied to all of the characters in the font. The amount of spacing between lines is determined explicitly by the value of Y_CH_SIZE.
For device fonts, the character size is fixed. When the device font system is in use, the value of X_CH_SIZE is silently ignored, and only the Y_CH_SIZE value is used.
The approximate number of pixels per centimeter in the X and Y directions.
The total size of the display or window in the X and Y directions, in device units.
The size of the visible area of the display or window. This area can be smaller than the total size fields.
This field contains the current X and Y zoom factors for the display or window. This field has relevance only with devices equipped with hardware zoom. A zoom factor of [1, 1] is normal.
Controls the direction of image transfers when using the TV, TVSCL, and TVRD procedures. If
The main plotting system variable structure. All fields, except
The background color index. When erasing the screen or page, all pixels are set to this color. The default value is 0. Not all devices support this feature.
The default source or destination channel. This field has meaning only on graphics devices that contain multiple display channels, and is device dependent. It may contain either a channel mask or index.
The overall character size of all annotations when Hershey fonts are selected. This field has no effect on the character size when hardware (device) fonts are selected, except for devices that support scalable pixel sizes (i.e., Postscript). Note, however, that
An integer specifying the thickness of the lines used to draw the characters when using the vector drawn fonts. This field has no effect on the appearance of characters drawn with the hardware fonts. Normal thickness is 1.
The device coordinates of the clipping window, a 6-element vector of the form [x0, y0, x1, y1, z0, z1], specifying two opposite corners of the volume to be displayed. In the case of two-dimensional displays, the Z coordinates can be omitted. Normally, the clipping window coordinates are implicitly set by PLOT, CONTOUR, SHADE_SURF, and SURFACE to correspond to the plot window. You may also manually set
The default color index.
An integer that specifies the graphics text font system to use. Set FONT equal to -1 to selects the Hershey character fonts, which are drawn using vectors. Set FONT equal to 0 (zero) to select the device font of the output device. Set FONT equal to 1 (one) to select the TrueType font system. See Fonts, for a complete description of IDL's font systems.
The default style of the lines used to connect points. A line style index of 0 yields a solid line. See LINESTYLE for a description of the linestyles.
Setting
!P.MULTI=[2,2,2] PLOT, X, Y
| Note |
For example, to gang two plots across the page:
!P.MULTI = [0, 2, 0, 0, 0] PLOT, X0, Y0 ;Make left plot. PLOT, X1, Y1 ;Right plot.
To gang two plots vertically:
!P.MULTI = [0, 0, 2, 0, 0] PLOT, X0, Y0 ;Make top plot. PLOT, X1, Y1 ;Bottom plot.
To make four plots per page, two across and two up and down:
!P.MULTI = [0, 2, 2, 0, 0]
and then call plot four times.
To reset
!P.MULTI = 0
A field which, if set, inhibits the clipping of the graphic vectors and vector-drawn text. By default, most routines clip to the plotting window, with the exception of PLOTS and XYOUTS.
Set this field to a non-zero value to inhibit erasing the screen before plotting.
The number of adjacent points to average to obtain a plotted point.
Specifies the normalized coordinates of the rectangular plot window. This is a four element floating point vector (x0, y0, x1, y1), where (x0, y0) is the origin, and (x1, y1) is the upper right corner.
| Note |
The default plotting symbol index. Each point drawn by PLOT, PLOTS, and OPLOT is marked with a symbol if this field is non-zero. The possible symbols are given in PSYM.
A four element vector that specifies the normalized coordinates of the rectangle enclosing the plot region, which includes the plot data window and its surrounding annotation area. It is in the same form as
| Note |
The plot subtitle, placed under the X axis label.
Contains the homogeneous 4 x 4 transformation matrix. This field is a two-dimensional array of double-precision floating-point values. For more information about transformations, refer to "Three-Dimensional Graphics" in the Using IDL manual.
Enables the three-dimensional to two-dimensional transformation contained in the homogeneous 4 by 4 matrix
The thickness of the lines connecting points. 1.0 is normal.
The main plot title.
The length of the tick marks, expressed as a fraction of the plot size (from 0.0 to 1.0). The default is 0.02. A value of 0.5 makes a grid. Negative values make the tick marks point outward.
The system variables
!X.MINOR = -1
To suppress the tick marks for just one call to plot, you could use the command:
PLOT, X, Y, XMINOR = -1
The name of the keyword parameter is simply the name of the system variable field, prefixed with the letter X, Y, or Z.
The fields for these system variables, in alphabetical order are:
The size of the characters used to annotate the axis and its title when Hershey fonts are selected. This field has no meaning when hardware (i.e. PostScript) fonts are selected. This field is a scale factor applied to the global scale factor. For example, setting
The output axis range. Setting this variable has no effect; set
| Note |
Example 1:
;Create a 10-element array. a = INDGEN(10) ;Plot the straight line. PLOT, a ;Print the minimum and maximum axis values. PRINT,!X.CRANGE
IDL prints:
0.00000 10.0000
Example 2:
;Plot a with logarithmic scaling on the X axis. PLOT, a, /XLOG ;Print the minimum and maximum axis values. PRINT,!X.CRANGE
The axis is scaled from 10-12 to 102. IDL prints:
-12.0000 2.00000
The index of the linestyle to be used for tick marks and grids. See LINESTYLE for a description of the linestyles
A 2-element array specifying the margin on the left (bottom) and right (top) sides of the plot window, in units of character size. The plot window is the rectangular area that contains the plot data, i.e. the area enclosed by the axes.
The default values for
When calculating the size and position of the plot window, IDL first determines the plot region, the area enclosing the window plus the axis annotation and titles. It then subtracts the appropriate margin from each side, obtaining the window.
Setting
The number of minor tick mark intervals. If
A 2-element array specifying the "outer" margin on the left (bottom) and right (top) sides of a multi-plot window, in units of character size. A multi-plot window is created by setting the
When calculating the size and position of the individual plots, IDL first determines the plot region, the area enclosing the window plus the axis annotation and titles. It then subtracts the appropriate margin from each side, obtaining the window.
Setting
The input axis range, a 2-element vector. The first element is the axis minimum, and the second is the maximum. Set this field, or use the corresponding keyword parameter, to specify the data range to plot. If axis end point rounding is selected (see STYLE above), the final axis range may not be equal to this input range. The field
!X.RANGE = 0
For example, to force the X axis to run from 5.5 to 8.3:
!X.RANGE = [5.5, 8.3] PLOT, X, Y
Alternatively, by using keywords:
PLOT, X, Y, XRANGE=[5.5, 8.3]
Note that even though the range was set to (5.5, 8.3), the resulting plot has a range of (5.5, 8.5), because axis rounding is the default.
Contains the normalized coordinates of the region. This field is similar to WINDOW, in that it is set by the graphics procedures and is a 2-element floating point array. To change the default plotting region, set
The scaling factors for converting between data coordinates and normalized coordinates (a 2-element array). The formula for conversion from data (Xd) to normalized (Xn) coordinates is Xn = S1Xd + S0
If logarithmic scaling is in effect, substitute log10(Xd) for Xd.
The CONVERT_COORD function can be used to convert between coordinate systems. The user should save and restore these fields when switching between windows or devices with different sizes and/or scaling.
The style of the axis encoded as bits in a longword. The axis style can be set to exact, extended, none, or no box using this field. The following table lists the axis style bit values:
Note that this system variable field is set bitwise, so multiple effects can be set by adding values together. For example, to make an X axis that is both exact (value 1) and suppresses the box style (setting 8), set the 1+8, or 9.
For example, to set the Y axis style to exact using the !Y system variable:
!Y.STYLE = 1
or by using a keyword parameter:
PLOT, X, Y, YSTYLE = 1
The thickness of the axis line. 1.0 is normal.
Set this field to a format string or a string containing the name of a function that returns a string to be used to format the axis tick mark labels.
See [XYZ]TICKFORMAT for more information.
A scalar indicating the interval between major tick marks for the first axis level. This setting takes precedence over
For example, if
See [XYZ]TICKINTERVAL for more information.
Set this keyword to a scalar that indicates the tick layout style to be used to draw each level of the axis.
See [XYZ]TICKLAYOUT for more information.
The lengths of tick marks (expressed in normal coordinates) for the individual axes.
The annotation for each tick. A string array of up to 60 elements. Setting elements of this array allows direct specification of the tick label. If this element contains a null string, the default value, IDL annotates the thick with its numeric value. Setting the element to a 1-blank string suppresses the tick annotation.
For example, to produce a plot with an abscissa labeled with the days of the week:
;Set up X axis tick labels.!X.TICKNAME = ['SUN', 'MON', 'TUE', 'WED', $ 'THU', 'FRI', 'SAT'] ;Use six tick intervals, requiring seven tick labels.!X.TICKS = 6 ;Plot the data, this assumes that Y contains 7 elements. PLOT, Y
The same plot can be produced, using keyword parameters, with:
;Set fields, as above, only temporarily. PLOT, Y, XTICKN = ['SUN', 'MON', 'TUE', 'WED',$ 'THU', 'FRI', 'SAT'], XTICKS = 6
The number of major tick intervals to draw for the axis. If
Set this keyword to a string (or a vector of strings) indicating the units to be used for axis tick labeling.
| Note |
| Note |
!X.TICKUNITS = '' ; Clear all previous tick unit strings.
!X.TICKUNITS = ['Days'] ;Single unit string in array.
The following:!X.TICKUNITS = 'Days'
will copy the 'Days' string to all levels, resulting in a multi-level axis.
See [XYZ]TICKUNITS for more information.
An array of up to 60 elements containing the data values for each tick mark. You can directly specify the location of each tick by setting
A string containing the axis title.
The type of axis, 0 for linear, 1 for logarithmic.
Contains the normalized coordinates of the axis end points, the plot data window. This field is set by PLOT, CONTOUR, SHADE_SURF, and SURFACE. Changing its value has no effect. A 2-element floating point array. To change the default plotting window, set