PLOTS Procedure

The PLOTS procedure plots vectors or points on the current graphics device in either two or three dimensions. The coordinates can be given in data, device, or normalized form using the DATA (the default), DEVICE, or NORMAL keywords.

The COLOR keyword can be set to a scalar or vector value. If it is set to a vector value, the line segment connecting (Xi, Yi) to (Xi+1, Yi+1) is drawn with a color index of COLORi+1. In this case, COLOR must have the same number of elements as X and Y.

Examples

Draw a line from (100, 200) to (600, 700), in device coordinates:

PLOTS, [100,600], [200,700], /DEVICE

Draw a polyline where the line color is proportional to the ordinate that ends each line segment.

; Set IDL to use decomposed color mode and load a good

; colortable to better show the result:

DEVICE, DECOMPOSED=0

LOADCT, 13



; Create datasets X and Y:

X = SIN(FINDGEN(100)) & Y = COS(FINDGEN(100))



; Now plot X and Y in normalized coordinates with colors as

; described above:

PLOTS, X, Y, COLOR = BYTSCL(Y, TOP=!D.N_COLORS-1), /NORMAL

Draw 3-D vectors over an established SURFACE plot. The SAVE keyword tells IDL to save the 3-D transformation established by SURFACE.

; Load the standard grayscale color table:
LOADCT, 0

; Draw a surface plot:
SURFACE, DIST(5), /SAVE

; Draw a line between (0,0,0) and (3,3,3). The T3D keyword makes
; PLOTS use the previously established 3-D transformation:
PLOTS, [0,3], [0,3], [0,3], /T3D

; Draw a line between (3,0,0) and (3,3,3):
PLOTS, [3,3], [0,3], [0,3], /T3D

; Draw a line between (0,3,0) and (3,3,3):
PLOTS, [0,3], [3,3], [0,3], /T3D

Syntax

PLOTS, X [, Y [, Z]] [, /CONTINUE]

Graphics Keywords:[, CLIP=[X0, Y0, X1, Y1]] [, COLOR=value] [, /DATA| , /DEVICE| , /NORMAL] [, LINESTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, /NOCLIP] [, PSYM=integer{0 to 10}] [, SYMSIZE=value] [, /T3D] [, THICK=value] [, Z=value]

Arguments

X

A vector or scalar argument providing the X components of the points to be connected. If only one argument is specified, X must be an array of either two or three vectors (i.e., (2,*) or (3,*)). In this special case, X[0,*] are taken as the X values, X[1,*] are taken as the Y values, and X[2,*] are taken as the Z values.

Y

An optional argument providing the Y coordinate(s) of the points to be connected.

Z

An optional argument providing the Z coordinates of the points to be connected. If Z is not provided, X and Y are used to draw lines in two dimensions.

Z has no effect if the keyword T3D is not specified and the system variable !P.T3D= 0.

Keywords

CONTINUE

Set this keyword to continue drawing a line from the last point of the most recent call to PLOTS.

For example:

; Draw X and Y axes

AXIS, XAXIS=0 & AXIS, YAXIS=0

 

; Position at (0,0):

PLOTS, 0, 0

 

; Draws vector from (0,0) to (3,3):

PLOTS, 3, 3, /CONTINUE

 

; Draws two vectors from (3,3) to (5,3) to (2,7):

PLOTS, [5,2], [3,7], /CONTINUE

Version History

Original

Introduced

See Also

ANNOTATE Procedure, PLOT, XYOUTS Procedure