Graphics Keywords

The IDL Direct G raphics routines, CURSOR, ERASE, PLOTS, POLYFILL, TV (and TVSCL), TVCRS, TVRD, and XYOUTS, and the plotting procedures, AXIS, CONTOUR, PLOT, OPLOT, SHADE_SURF, and SURFACE, accept a number of common keywords. Therefore, instead of describing each keyword along with the description of each routine, this section contains a brief summary of each graphics keyword. Routine-specific keywords are documented in the description of the routine in , " ."

The graphics keywords are described below. Click on a keyword in the scrolling list at left. The name of the keyword appears followed by a list of routines that accept that keyword. Keywords that have a direct correspondence to fields in a system variable (usually !P) are also indicated.

The keywords that control the plot axes are prefixed with the character `X', `Y', or `Z' depending on the axis in question. These keywords correspond to fields in the axis system variables: !X, !Y, and !Z, and are described in more detail in The axis keywords are shown in the form [XYZ]NAME. For example, [XYZ]CHARSIZE refers to the three keywords XCHARSIZE, YCHARSIZE, and ZCHARSIZE, which control the size of the characters annotating the three axes.

The system variable fields that control this are !X.CHARSIZE, !Y.CHARSIZE, and !Z.CHARSIZE.

BACKGROUND

Accepted by: CONTOUR , PLOT , SURFACE . System variable equivalent: !P. .

The background color index to which all pixels are set when erasing the screen or page. The default is 0 (black). Not all devices support erasing the background to a specified color index.

PLOT, Y, BACKGROUND = 255, COLOR = 0

CHANNEL

Accepted by: ERASE , TV , TVRD . System variable equivalent: !P. .

This keyword specifies the memory channel for the operation. This parameter is ignored on display systems that have only one memory channel. When using a "decomposed" display system, the red channel is 1, the green channel is 2, and the blue channel is 3. Channel 0 indicates all channels. If omitted, !P.CHANNEL contains the default channel value.

CHARSIZE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE , XYOUTS . System variable equivalent: !P. .

The overall character size for the annotation when Hershey fonts are selected. This keyword does not apply when hardware (i.e. PostScript) fonts are selected. A CHARSIZE of 1.0 is normal. The size of the annotation on the axes may be set, relative to CHARSIZE, with x CHARSIZE, where x is X, Y, or Z. The main title is written with a character size of 1.25 times this parameter.

[ XYZ]CHARSIZE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalents: ![XYZ]. .

The size of the characters used to annotate the axis and its title when Hershey fonts are selected. This keyword does not apply when hardware (i.e. PostScript) fonts are selected. This field is a scale factor applied to the global scale factor set by !P.CHARSIZE or the keyword CHARSIZE.

CHARTHICK

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE , XYOUTS . System variable equivalent: !P. .

An integer value specifying the line thickness of the vector drawn font characters.This keyword has no effect when used with the hardware drawn fonts. The default value is 1.

CLIP

Accepted by: AXIS , CONTOUR , OPLOT , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE , XYOUTS . System variable equivalent: !P. .

The coordinates of a rectangle used to clip the graphics output. The rectangle is specified as a vector of the form [ X 0 , Y 0 , X 1 , Y 1 ], giving coordinates of the lower left and upper right corners, respectively. The default clipping rectangle is the plot window, the area enclosed within the axes of the most recent plot. Coordinates are specified in data units unless an overriding coordinate unit specification keyword is present (i.e., NORMAL or DEVICE).

PLOTS, X, Y, CLIP=[0.,.5,.5,1.0], /NORM, NOCLIP=0

COLOR

Accepted by: AXIS , CONTOUR , ERASE , OPLOT , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE , XYOUTS . System variable equivalent: !P. .

The color index of the data, text, line, or solid polygon fill to be drawn. If this keyword is omitted, !P.COLOR specifies the color index.

When used with the PLOTS, POLYFILL, or XYOUTS procedure, this keyword parameter can be set to a vector to specify multiple color indices.

Gouraud shading of polygons is performed with the Z-buffer graphics output device and POLYFILL procedure when COLOR contains an array of color indices, one for each vertex.

DATA

Accepted by: AXIS , CONTOUR , CURSOR , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE , TV , TVCRS , XYOUTS .

Set this keyword to indicate that the clipping and/or positioning coordinates supplied are specified in the data coordinate system. The default coordinate system is DATA if no other coordinate-system specifications are present.

DEVICE

AXIS , CONTOUR , CURSOR , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE , TV , TVCRS , XYOUTS .

Set this keyword to indicate that the clipping and/or positioning coordinates supplied are specified in the device coordinate system. The default coordinate system is DATA if no other coordinate-system specifications are present.

TV,A ; Display the image.

CONTOUR, A[100:499, 100:399], $

    POS = [100,100, 499,399], /DEVICE, $

   /NOERASE, XSTYLE=1, YSTYLE=1; Draw the contour plot, specify the coordinates of the plot, in device coordinates, do not erase, set the X and Y axis styles to EXACT.

Note that in the above example, the keyword specification /DEVICE is equivalent to DEVICE = 1 .

FONT

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE , XYOUTS . System variable equivalent: !P. .

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 for a complete description of IDL's font systems.

[XYZ]GRIDSTYLE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE

The index of the linestyle to be used for plot tickmarks and grids (i.e., when [XYZ]TICKLEN is set to 1.0). See IDL Linestyles for a list of linestyles.

LINESTYLE

Accepted by: OPLOT , PLOT , PLOTS , SURFACE . System variable equivalent: !P. .

This keyword indicates the line style used to draw lines; it indicates the line style of the lines used to connect the data points. This keyword should be set to the appropriate index for the desired linestyle as described in the following table.

  • IDL Linestyles

Index

Linestyle

0

Solid

1

Dotted

2

Dashed

3

Dash Dot

4

Dash Dot Dot Dot

5

Long Dashes

[XYZ]MARGIN

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

A 2-element array specifying the margin on the left (bottom) and right (top) sides of the plot window, in units of character size. Default margins are 10 and 3 for the X axis, and 4 and 2 for the Y axis. The ZMARGIN keyword is present for consistency and is currently ignored.

[XYZ]MINOR

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

The number of minor tick marks.

NOCLIP

Accepted by: AXIS , CONTOUR , OPLOT , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE , XYOUTS . System variable equivalent: !P. .

Set this keyword to suppress clipping of the plot. The clipping rectangle is contained in !P. . By default, the plot is clipped within the plotting window.

With PLOTS, POLYFILL, and XYOUTS, this keyword controls the clipping of vectors and vector-drawn text. The default is to disable clipping, so to enable clipping include the parameter NOCLIP = 0. To explicitly disable clipping set this parameter to one.

NODATA

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE .

If this keyword is set, only the axes, titles, and annotation are drawn. No data points are plotted.

PLOT, [XMIN, XMAX],[YMIN, YMAX], /NODATA

NOERASE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: !P. .

Specifies that the screen or page is not to be erased. By default, the screen is erased, or a new page is begun, before a plot is produced.

 

 

NORMAL

Accepted by: AXIS , CONTOUR , CURSOR , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE , TV , TVCRS , XYOUTS .

Set this keyword to indicate that the clipping and/or positioning coordinates supplied are specified in the normalized coordinate system, and range from 0.0 to 1.0. The default coordinate system is DATA if no other coordinate-system specifications are present.

ORIENTATION

Accepted by: POLYFILL , XYOUTS .

Specifies the counterclockwise angle in degrees from horizontal of the text baseline and the lines used to fill polygons.When used with the POLYFILL procedure, this keyword forces the "linestyle" type of fill, rather than solid or patterned fill.

POSITION

Accepted by: CONTOUR , MAP_SET , PLOT , SHADE_SURF , SURFACE . System variable equivalent: !P. .

Allows direct specification of the plot window. POSITION is a 4-element vector giving, in order, the coordinates [(X 0 , Y 0 ), (X 1 , Y 1 )], of the lower left and upper right corners of the data window. Coordinates are expressed in normalized units ranging from 0.0 to 1.0, unless the DEVICE keyword is present, in which case they are in actual device units. The value of POSITION is never specified in data units, even if the DATA keyword is present.

When setting the position of the window, be sure to allow space for the annotation, which resides outside the window. IDL outputs the message "% Warning: Plot truncated." if the plot region is larger than the screen or page size. The plot region is the rectangle enclosing the plot window and the annotation.

When plotting in three dimensions, the POSITION keyword is a 6-element vector with the first four elements describing, as above, the XY position, and with the last two elements giving the minimum and maximum Z coordinates. The Z specification is always in normalized coordinate units.

When making more than one plot per page it is more convenient to set !P. than to manipulate the position of the plot directly with the POSITION keyword.

CONTOUR, Z, POS=[0., 0.5, 0.5, 1.0]

Because no space on the left or top edges was allowed for the axes or their annotation, the above described warning message results.

 

 

 

PSYM

Accepted by: OPLOT , PLOT , PLOTS . System variable equivalent: !P. .

The symbol used to mark each data point. Normally, PSYM is 0, data points are connected by lines, and no symbols are drawn to mark the points. Set this keyword, or the system variable !P.PSYM, to the symbol index as shown in the table below to mark data points with symbols. The keyword SYMSIZE is used to set the size of the symbols.

  • Values for the PSYM Keyword

PSYM Value

Plotting Symbol

1

Plus sign (+)

2

Asterisk (*)

3

Period (.)

4

Diamond

5

Triangle

6

Square

7

X

8

User-defined. See USERSYM procedure.

9

Undefined

10

Histogram mode. Horizontal and vertical lines connect the plotted points, as opposed to the normal method of connecting points with straight lines.

Negative values of PSYM cause the symbol designated by PSYM to be plotted at each point with solid lines connecting the symbols. For example, a value of -5 plots triangles at each data point and connects the points with lines.

PLOT, A, PSYM=3 ; Plot using points.

OPLOT, SMOOTH(A,7) ; Overplot smoothed data.

[XYZ]RANGE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

The desired data range of the axis, a 2-element vector. The first element is the axis minimum, and the second is the maximum. IDL will frequently round this range. This override can be defeated using the [XYZ]STYLE keywords.

[XYZ]STYLE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

This keyword allows specification of axis options such as rounding of tick values and selection of a box axis. Each option is described in Values for the [XYZ]STYLE Keyword .

  • Values for the [XYZ]STYLE Keyword

Value

Description

1

Force exact axis range.

2

Extend axis range.

4

Suppress entire axis

8

Suppress box style axis (i.e., draw axis on only one side of plot)

16

Inhibit setting the Y axis minimum value to 0 (Y axis only)

Note that this keyword 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 XAXIS keyword to 1+8 , or 9.

SUBTITLE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: !P. .

A text string to be used as a subtitle for the plot. Subtitles appear below the X axis.

SYMSIZE

Accepted by: OPLOT , PLOT , PLOTS .

Specifies the size of the symbols drawn when PSYM is set. The default size of 1.0 produces symbols approximately the same size as a character.

T3D

Accepted by: AXIS , CONTOUR , MAP_SET , OPLOT , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE , TV , TVCRS , XYOUTS . System variable equivalent: !P. .

Set this keyword to indicate that the generalized transformation matrix in !P.T is to be used. If not present, the user-supplied coordinates are simply scaled to screen coordinates. See the examples in the description of the SAVE keyword.

THICK

Accepted by: AXIS , OPLOT , PLOT , PLOTS , POLYFILL , SHADE_SURF , SURFACE . System variable equivalent: !P. .

Indicates the line thickness. THICK overrides the setting of !P.THICK.

[XYZ]THICK

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

This keyword controls the thickness of the lines forming the axis and tick marks. A value of 1.0 is the default.

[XYZ] TICKFORMAT

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

Set this keyword 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 .

If the argument to the TICKFORMAT keyword does not begin with the an open parenthesis, "(", the string is interpreted as the name of a function. The function is called with three parameters: Axis , Index , and Value where:

Used with the LABEL_DATE function, this keyword can easily create axes with date labels. LABEL_DATE

PLOT, X, Y, XTICKFORMAT='(F6.2)'

To display the Y tick values using the "dollars and cents" format $ dddd.dd , use:

PLOT, X, Y, YTICKFORMAT='("$", F7.2)'

FUNCTION YTICKS, axis, index, value

hour = LONG(value)/3600

minute = LONG(value-3600 * hour) / 60

sec = value mod 60

RETURN, STRING(hour, minute, sec, $

        FORMAT="(i2.2, ':', i2.2, ':', i2.2)")

END

Then use the call:

PLOT, T, YTICKFORMAT='YTICKS'

TICKLEN

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: !P. .

Controls the length of the axis tick marks, expressed as a fraction of the window size. The default value is 0.02. TICKLEN of 1.0 produces a grid, while a negative TICKLEN makes tick marks that extend outside the window, rather than inwards.

PLOT, X, Y, TICKLEN = -0.02

To provide a new default tick length, set !P.TICKLEN.

[ XYZ]TICKLEN

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

This keyword controls the lengths of tick marks (expressed in normal coordinates) for the individual axes. This keyword, if nonzero, overrides the global tick length specified in !P.TICKLEN, and/or the TICKLEN keyword parameter, which is expressed in terms of the window size.

[ XYZ]TICKNAME

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

A string array of up to 30 elements that controls the annotation of each tick mark.

[ XYZ]TICKS

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

The number of major tick intervals to draw for the axis. If this keyword is omitted, IDL selects from three to six tick intervals. Setting this field to n , where n > 1, produces exactly n tick intervals, and n +1 tick marks. Setting this field equal to 1 suppresses tick marks.

 

 

 

[ XYZ]TICKV

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

The data values for each tick mark, an array of up to 30 elements. Note: to specify the number of ticks and their values exactly, set [XYZ]TICKS =  n and [XYZ]TICKV =  + 1, where n  > 1.

[ XYZ]TICK_GET

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE .

A named variable in which to return the values of the tick marks for the designated axis. The result is a floating-point array with the same number of elements as ticks.

PLOT, X, Y, YTICK_GET = V

TITLE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: !P. .

Produces a main title centered above the plot window. The text size of this main title is larger than the other text by a factor of 1.25. For example:

PLOT, X, Y, TITLE = 'Final Results'

[XYZ]TITLE

Accepted by: AXIS , CONTOUR , PLOT , SHADE_SURF , SURFACE . System variable equivalent: ![XYZ]. .

A string that contains a title for the specified axis.

ZVALUE

Accepted by: AXIS , CONTOUR , MAP_SET , OPLOT , PLOT , SHADE_SURF , SURFACE .

Sets the Z coordinate, in normalized coordinates in the range of 0 to 1, of the axis and data output from PLOT, OPLOT, and CONTOUR.

This keyword has effect only if !P.T3D is set and the three-dimensional to two- dimensional transformation is stored in !P.T. If ZVALUE is not specified, CONTOUR will output each contour at its Z coordinate, and the axes and title at a Z coordinate of 0.0.

Z

Accepted by: PLOTS , POLYFILL , TV , TVCRS , XYOUTS .

Provides the Z coordinate if a Z parameter is not present in the call. This is of use only if the three-dimensional transformation is in effect (i.e., the T3D keyword is not set).