Previous IDL Reference Guide: Procedures and Functions Next

USERSYM

Syntax | Arguments | Keywords | Examples | Version History | See Also

The USERSYM procedure is used to define the plotting symbol that marks points when the PSYM keyword symbol is set to plus or minus 8. Symbols can be drawn with vectors or can be filled. Symbols can be of any size and can have up to 49 vertices.

The symbol you define can be drawn using lines or it can be filled using the polygon filling operator. USERSYM accepts two vector parameters: a vector of x values and a vector of y values. The coordinate system you use to define the symbol's shape is centered on each data point, and each unit is approximately the size of a character. The color and line thickness used to draw the symbols are also optional keyword parameters of USERSYM.

Syntax

USERSYM, X [, Y] [, COLOR=value] [, /FILL] [, THICK=value]

Arguments

X, Y

The X and/or Y parameters define the vertices of the symbol as offsets from the data point in units of approximately the size of a character. In the case of a vector drawn symbol, the symbol is formed by connecting the vertices in order. If only one argument is specified, it must be a (2, N) array of vertices, with element [0, i] containing the X coordinate of the vertex, and element [1, i] containing the Y. If both arguments are provided, X contains only the X coordinates.

Keywords

COLOR

The color used to draw the symbols, or used to fill the polygon. The default color is the same as the line color.

FILL

Set this keyword to fill the polygon defined by the vertices. If FILL is not set, lines are drawn connecting the vertices.

THICK

The thickness of the lines used in drawing the symbol. The default thickness is 1.0.

Examples

To define the simplest symbol, use a one character-wide dash centered over the data point:

USERSYM, [-.5, .5], [0, 0]  

Make a large, diamond-shaped plotting symbol. Define the vectors of X values by entering:

X = [-6, 0, 6, 0, -6]  

Define the vectors of Y values by entering:

Y = [0, 6, 0, -6, 0]  

Now call USERSYM to create the new plotting symbol 8. Enter:

USERSYM, X, Y  

Generate a simple plot to test the plotting symbol by entering:

PLOT, FINDGEN(20), PSYM = 8  

Creating a Filled Circle Symbol

The following code illustrates the use of USERSYM to define a new symbol—a filled circle:

; Make a vector of 16 points, A[i] = 2pi/16:  
A = FINDGEN(17) * (!PI*2/16.)  
; Define the symbol to be a unit circle with 16 points,   
; and set the filled flag:  
USERSYM, COS(A), SIN(A), /FILL  

Using the variables defined in a batch file, we then create the plot, specifying 8 (user-defined) for the PSYM keyword to PLOT:

; Define variables.  
@plot01  
; Use the LINFIT function to fit the data to a line:  
coeff = LINFIT(YEAR, SOCKEYE)  
;YFIT is the fitted line:  
YFIT = coeff[0] + coeff[1]*YEAR  
  
PLOT, YEAR, SOCKEYE, /YNOZERO, PSYM = 8, $  
   TITLE = 'Quadratic Fit', XTITLE = 'Year', $  
   YTITLE = 'Sockeye Population'  
; Overplot the smooth curve using a plain line:  
OPLOT, YEAR, YFIT  

The following figure shows the result of this code:

 

Figure 3-149: Plotting with User-defined Plotting Symbols

Figure 3-149: Plotting with User-defined Plotting Symbols


Note
If IDL does not find the batch file, the required directory may not be in your IDL search path. All of the files mentioned are located in the examples/doc subdirectory of the IDL distribution. By default, this directory is part of IDL's path; if you have not changed your path, you will be able to run the examples as described here. See !PATH for information on modifying IDL's path.

Version History

Original
Introduced

See Also

PLOT

  IDL Online Help (March 06, 2007)