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 ( X i , Y i ) to ( X i+1 , Y i+1 ) is drawn with a color index of COLOR i+1 . In this case, COLOR must have the same number of elements as X and Y .

Calling Sequence

PLOTS, X [, Y [, Z]]



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.


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


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.



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

PLOTS, 0, 0 ; Position at (0,0).

PLOTS, 1, 1, /CONTINUE ; Draws vector from (0,0) to (1,1).

PLOTS, [2,3], [2,3], /CONTINUE ; Draws two vectors from (1,1) to (2,2) to (3,3).

Graphics Keywords Accepted

See , Graphics Keywords , for the description of graphics and plotting keywords not listed above. CLIP


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

PLOTS, [100,600], [200,700], COLOR=12, /DEVICE

Draw a polyline where the line color is proportional to the ordinate that ends each line segment. First create datasets X and Y by entering:

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

Now plot X and Y in normalized coordinates with colors as described above:


Load a good colortable to better show the result. Enter:


Draw 3D vectors over an established SURFACE plot:

SURFACE, DIST(5), /SAVE ; The SAVE keyword tells IDL to save the 3D transformation established by SURFACE.

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

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

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

See Also