Group: | Plot Manipulation |
See also: | setmaskp show setmaskt |
Function: | setmaskl | |
Description: |
Use setmaskl to connect datapoints by lines. setmaskl has to preceed show. That is,
first you call setmaskl to specify which points to connect and the layout of the line(s).
Then you use the command show to plot the datapoints and the line(s) that connect them..
|
Usage: | setmaskl(data, p_matrix, color_num, art, thick) | |
Input: | ||
data | a data matrix | |
p_matrix | a matrix of integers that tells setmaskl 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 1st, 3rd and 5th point of the datamatrix. Use 0 to interrupt lines. That is¸ the row 1,3,0,5,6 will connect the 1st and the 3rd point , then interrupt the line and continue it by connecting the 5th and the 6th point. | |
color_num | a column vector of integers, that has the same number or rows as p_matrix. Each element specifies the color of the corresponding line from p_matrix. 0 is black, 1 is blue, 2 is green, 3 is cyan, 4 is red, 5 is magenta, 6 is yellow, 7 is 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 or 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. |
d = createdisplay(1,1) x = #(-2,-1,0,1,2) ; generate test data, equally spaced 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 colors ar = #(1,2,3) ; art, controls line types th = #(6,3,1) ; thick, controls line thickness setmaskl(dat ,pm ,cn , ar, th) show(d, 1, 1, dat)
connects points 1 and 3 with a blue thick line. connects points 1, 2 and 3 with a dashed green thin line. connects points 1, 5 and points 1, 4, 2 with a dashed red thin line
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 fivth point a red circle fiveth=5*(1:20) ; fiveth contains #(5, 10, 15, 20, ..., 100) tenth=10*(1:10) | (matrix(10)-1) ; tenth contains #(10, 20, ..., 100, 0, .., 0) setmaskl(data, (fiveth ~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()
a thick, solid, blue line connecting the points 10, 20, ..., 100, and a a thin, solid, red line connecting the points 5, 10, ..., 100
Group: | Plot Manipulation |
See also: | setmaskp show setmaskt |