Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Plot Manipulation
See also: setmaskp show setmaskt

Function: setmaskl
Description: Connects certain data points by lines, which can be defined separately.

Link:
Usage: setmaskl(data, p_matrix, color_num, art, thick)
Input:
data n x p matrix containing the data
p_matrix a matrix of integers specifying which points to connect. Each row of the matrix corresponds to one line. For instance, if you want to draw three lines then p_matrix needs to have three rows. Each row must have the same number of elements. A row consisting of the integers 1, 3 and 5 will result in a line that connects the first, the third and the fifth point of the data matrix. 0 is used to interrupt lines. E.g. the row 1,3,0,5,6 will connect the first and the third point, then the line is interrupted and continued by connecting the fifth and the sixth point.
color_num a column vector of integers, that has the same number of rows as p_matrix. Each element specifies the color of the corresponding line from p_matrix: 0 : black, 1 : blue, 2 : green, 3 : cyan, 4 : red, 5 : magenta, 6 : yellow, 7 : white
art a column vector of integers, that has the same number of rows as p_matrix. Each element specifies the appearance of the corresponding line from p_matrix: 0 : invisible line, 1 : solid line, 2 : finely dashed line, 3 : less finely dashed line, 4 : even less finely dashed line, and so on.
thick a column vector of integers, that has the same number of rows as p_matrix. Each element specifies the thickness of the corresponding line from p_matrix. 0 will produce the thinnest line and increasing integers produce lines of increasing thickness. 15 produces the thickest line possible.

Note:

Example:
d = createdisplay(1,1)
x = #(-2,-1,0,1,2)  	;  generate equally spaced test data
dat = x~(x^2)       	;  each point on a parabola
pm =(#(1,3,0,4,5)')|(#(1,2,3,0,0)')|(#(5,1,4,2,0)')
;  p_matrix, indicating which points in
;  dat to connect with lines
;  three rows ---> three lines
;  0 ---> a break in the line
cn = #(1,2,4)       	;  color_num, controls the colors
ar = #(1,2,3)       	;  art, controls the line types
th = #(6,3,1)       	;  thick, controls the line thickness
setmaskl(dat,pm,cn,ar,th)
show(d, 1, 1, dat)

Result:
A display is shown where:
points 1 and 3 are connected with a blue thick line;
points 1, 2 and 3 with a dashed green thin line and
points 1, 5 and points 1, 4, 2 are connected with
a dashed thin red line.
Example:
proc() = testline()		// an even  more complicated example
  di=createdisplay(1, 1)
  x=1:100
  y=sin(x/20)+uniform(100, 1)/5
  data=x~y
  part=#(1, 1, 1, 1, 4)
  i=1
  while(i<20)
    part=part|(#(1, 1, 1, 1, 4))
    i=i+1
  endo
  ; part contains now #(1, 1, 1, 4, 1, 1, 1, 4, ..., 1, 1, 1, 4)
  setmaskp(data, part, 3, 8)
  ; makes each fifth point a red circle
  fifth=5*(1:20)
  ; fifth contains #(5, 10, 15, 20, ..., 100)
  tenth=10*(1:10) |(matrix(10)-1)
  ; tenth contains #(10, 20, ..., 100, 0, .., 0)
  setmaskl(data,(fifth ~ tenth)', #(4, 1), 1, #(2, 4))
  ; connect points 5, 10, ..., 100 with a solid red line,
  ; 2 pixels thick
  ; and points 10, 20, ..., 100 with a solid blue line,
  ; 4 pixels thick
  show(di, 1, 1, data)
endp
testline()

Result:
A display showing the data and additionally
a thick, solid, blue line connecting the points
10, 20, ..., 100, and a thin, solid, red line
connecting the points 5, 10, ..., 100 is obtained.



(C) MD*TECH Method and Data Technologies, 05.02.2006