next up previous contents
Next: 6.3 Plotting a Selected Up: 6 PLOTTING YOUR SPECTRA Previous: 6.1 Plotting Data with

6.2 System Variables and Keywords

Your IDL variables are only defined in the current program being run, or in the main session when you are not running a program. Subroutines may have different variables than the program that called them. System variables, however, are understood and defined everywhere. Some cannot be changed, but there are many that can be set by the user, and they remain set until they are changed again in a given IDL session.

System variable names begin with the character ``!'', which is often called ``bang''. Some are structures, which means that they may have a number of separate fields. For example, the system variable !X is a structure, and it includes fields such as !X.MARGIN, !X.RANGE, and !X.TITLE, which will all be discussed in this chapter. Table 6.3 shows some useful system variables.

 
 
Table 6.3: System Variables
!PI Floating point $\pi$, read only.
!DPI Double precision $\pi$, read only.
!DTOR Floating point $\pi/180$, read only.
!RADEG Floating point $180/\pi$, read only.
!P Structure containing plotting parameters.
!X Structure containing X axis parameters.
!Y Structure containing Y axis parameters.

There are many keyword parameters that may be included in procedure call statements. For IUEDAC programs, you may use DOC_LIBRARY to find out about keywords that apply to a given procedure. A number of IDL commands use keywords which correspond to the fields in the !P, !X, and !Y system variables. They may be used to affect individual plotting commands without changing the actual system variable settings. Table 6.4 shows some of the useful keywords for plotting, and the system variable fields that correspond to them.

Some keywords are set equal to numbers, strings, or vectors in the procedure call, e.g., plot,w,f,psym=2. Others are simply included in the procedure call with a slash, e.g., plot,w,f,/ynozero (the slash is a shorthand notation for setting the keyword parameter equal to one). All keywords included in this table are discussed in this chapter. More keywords and system variables are discussed in the IDL User's Guide.

 
 
Table 6.4: Keywords for Plotting
Keyword System Variable Explanation
PSYM !P.PSYM Plot symbol. Default=10 (histogram mode).
XTITLE !X.TITLE X axis title.
YTITLE !Y.TITLE Y axis title.
TITLE !P.TITLE Main plot title.
/YNOZERO !Y.STYLE=16 Disable setting Y minimum to zero.
XRANGE !X.RANGE Range of X axis.
YRANGE !Y.RANGE Range of Y axis.
POSITION !P.POSITION Vector containing the four axis endpoints in normalized coordinates [x0,y0,x1,y1]
XMARGIN !X.MARGIN Left and right margins between the plot and the plotting region borders in character units.
YMARGIN !Y.MARGIN Top and bottom margins between the plot and the plotting region borders in character units.
XSTYLE !X.STYLE X axis style options. XSTYLE=1 forces the X axis to be exactly as specified in the XRANGE keyword, with no rounding allowed.
YSTYLE !Y.STYLE Y axis style options, which correspond to XSTYLE except for the YNOZERO option (YSTYLE=16). Each option is represented by one bit. See the IDL User's Guide for more details.
LINESTYLE !P.LINESTYLE Type of line used to connect data points. Default=0 (solid line).
/NOERASE !P.NOERASE Do not erase the screen before plotting.
FONT !P.FONT Fonts used to write text. Default=0 (hardware fonts). For vector drawn fonts, set equal to -1.


next up previous contents
Next: 6.3 Plotting a Selected Up: 6 PLOTTING YOUR SPECTRA Previous: 6.1 Plotting Data with

2/9/1998