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

Library: plot
See also: setmaskp setmaskl grsurface setmaskt createcolor freecolor

Quantlet: setmask
Description: Front-end for the setting of mask vectors that allows easy definitions for points, lines (polygons), surfaces and text.

Link:
Usage: xm = setmask(x{,s1{,s2,...}})
Input:
x n x k matrix, data. For a curve in 2D, data should be n x 2, and (typically) sorted by the first column. For a surface in 3D, data should be n x 3, sorted by the first column and the first two columns should form a grid.
s1,s2,... scalar, vector or matrix, string or numeric. Arguments may be keywords ("line", "surface", "text","reset"), sub-keywords ("color", "size", "style"), or attributes. Attributes may be string or numeric. Predefined string attributes can be found under [points], [lines] and [text] below. Numeric attributes need to follow the rules of setmaskp, setmaskl and setmaskt (e.g. 0..7 for basic colors). The keywords are used to separate different graphical objects (points, line, surface, text) from each other: Attributes following a keyword are assigned to the according object. Attributes without preceeding keyword are assigned to points. The "reset" keyword is special, see the note below. Text to be displayed must immediately follow the the "text" keyword. A polygon is optional, the default polygon for "line" is (1:n)' which connects points subsequently. An optional polygon definition must immediately follow the "line" keyword. Numerical values for color, size and style must be preceeded by the corresponding sub-keyword. In case of two or more attributes for one feature (e.g. "blue" and "red" together), the latest attribute is used. ==> Please check the examples! They are fairly instructive.
[points] color = "black", "blue", "green", "cyan", "red", "magenta", "yellow", "white" / size = "nopoint", "tiny", "small", "medium", "large", "huge" (corresponding to values 0, 1, 2, 4, 8, 12, 15 in setmaskp) / style = "empty", "point", "rectangle", "circle", "triangle", "xsymbol" "rhomb", "fillrectangle", "fillcircle", "fillrhomb", "filltriangle", "cross", "star", "grid", "gridrhomb","?" / (defaults = "black", "medium", "circle")
[lines] color = "black", "blue", "green", "cyan", "red", "magenta", "yellow", "white" / size = "noline", "thin", "medium", "thick", "band", "fill" (corresponding to values 0, 1, 2, 5, 14, 15 in setmaskl) / style = "invisible", "solid", "dashed", "dotted" / (defaults = "black", "medium", "solid")
[text] color = "black", "blue", "green", "cyan", "red", "magenta", "yellow", "white" / size = "tiny", "small", "medium", "large", "huge" (corresponding to fontsizes 8, 12, 14, 16, 20 in setmaskt) / style = "request", "center", "right", "below", "left", "above" / (defaults = "black", "medium", "center")
Output:
xm n x k matrix, data provided with mask.

Note:

Example:

library("plot")

;

; == defining display and some data sets ==========

;

pic=createdisplay(2,3)

n=20

x=normal(n,3)

y=sort(x[,1]~cos(x[,1]))

z=sort(grid(-3|-3,0.4|0.4,16|16),1:2)

z=z~prod(pdfn(z),2)

;

; == no mask -> default black medium circles ======

;

x=setmask(x)

show(pic,1,1,x)

;

; == huge orange grids -> setmask takes rgb =======

;

orange=255~165~0

x=setmask(x,"color",orange,"grid","huge") 

show(pic,1,2,x)

;

; == two groups of points =========================

;

mycolor=string("cyan",1:n/2)|string("red",n/2+1:n)

mystyle=string("fillcircle",1:n/2)|string("cross",n/2+1:n) 

x=setmask(x,"reset",mycolor,mystyle)

show(pic,1,3,x)

;

; == thick blue line, red left positioned text ====

;

mytext=string(" ",1:n) ; -> all strings blank

mytext[n]="cosine"     ; -> but last = "cosine"

y=setmask(y,"reset","line","blue","thick","text",mytext,"left","red")

show(pic,2,1,y)

;

; == red thin surface, green small filled rhombs ==

;

z=setmask(z,"reset","green","small","fillrhomb","surface","red","thin")

show(pic,2,2,z)

setgopt(pic,2,2,"title","ROTATE!")

;

; == differently colored numbers in circles  ======

;

mytext=string("%1.0f",1:n)  ; -> text = numbers

mycolor=(1:n)%7             ; -> numeric colors

x=setmask(x,"reset","circle","huge","text",mytext,"color",mycolor,"size",11)

show(pic,2,3,x)

Result:

Exciting plots! Check it out!


Library: plot
See also: setmaskp setmaskl grsurface setmaskt createcolor freecolor

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

Author: Marlene Mueller, 971006
(C) MD*TECH Method and Data Technologies, 21.9.2000