You have almost complete control of the number, style, placement, thickness, and annotation of the tick marks. The following plotting keyword parameters and their corresponding system variable fields affect the tick marks:
The index of the line style to be used for plot tick marks and grids (i.e., when TICKLEN is set to 1.0). See [XYZ]GRIDSTYLE for more information.
The number of minor-tick intervals. If set to zero, the default, IDL automatically determines the number of minor ticks in each major tick-mark interval. Setting this parameter to 1 suppresses the minor ticks, and setting it to a positive, nonzero number, n, produces n minor-tick intervals, and n-1 minor-tick marks. See [XYZ]MINOR for more information.
The thickness of the x, y, or z axes and their tick marks. This parameter is set with the field THICK in the axes system variables,
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. See [XYZ]TICKFORMAT for more information.
The length of each major-tick mark, expressed as a fraction of the window size in the tick mark's direction. The default value is 0.02. A length of 1.0 produces a grid. A value of -0.02 makes tick marks that extend away from the plot. Individual axis ticks can be controlled with the [XYZ]TICKLEN keyword. See TICKLEN for more information.
A string array containing the annotation of each major-tick mark. If omitted or if a given string element contains the null string, IDL labels the tick mark with its value. To suppress the tick labels, supply a string array of one-character long, blank strings, i.e.,
REPLICATE(' ', N). Null strings force IDL to number the tick mark with its value. See [XYZ]TICKNAME for more information.
The number of major tick-mark intervals. If set to zero or omitted, IDL produces between three and six intervals. See [XYZ]TICKS for more information.
The data values of each tick mark. You can directly specify these values, producing graphs with arbitrary tick marks. If you do this, IDL scales the axis from the first tick value to the last unless you directly specify a range. As above, be sure to provide n + 1 tick values. See [XYZ]TICKV for more information.
The following figure shows a box chart illustrating the direct specification of the x-axis tick values, number of ticks, and tick names. Building upon the previous program, this program shows each of the four scores for the year 1967, the first year in our data. It uses the BOX procedure from the previous example to draw a rectangle for each sample.
Using the data and variables from above, the following commands create the box chart:
Enter the following command at the IDL prompt to compile the
BARGRAPH procedures (discussed in the previous example) from the IDL distribution:
Enter the following commands to create the box chart:
; Define variables: @plot01 ; Tick x values, 0.2, 0.4, 0.6, 0.8: XVAL = FINDGEN(4)/5. + .2 ; Make a vector of scores from first year, corresponding to ; the name vector from above: YVAL = [COHO, SOCKEYE, HUMPBACK, CHINOOK] ; Make the axes with no data. Force x range to [0, 1], ; centering xval, which also contains the tick values. ; Force three tick intervals making four tick marks. ; Specify the tick names from the names vector: PLOT, XVAL, YVAL, /YNOZERO, XRANGE = [0,1], XTICKV = XVAL, $ XTICKS = 3, XTICKNAME = NAMES, /NODATA, $ TITLE = 'Salmon Populations, 1967' ; Draw the boxes, centered over the tick marks. ;
!Y.CRANGEis the y value of the bottom x-axis. FOR I = 0, 3 DO BOX, XVAL[I] - .08, !Y.CRANGE,$ XVAL[I] + 0.08, YVAL[I], 128
Alternatively, you can run the following batch file to create the plot:
See Running the Example Code if IDL does not find the batch file.
See Multiple Plots on a Page for more examples of ways you can control where axes are drawn, tick mark length, and placement.