Next: manova() Up: MacAnova Help File Previous: makestr()   Contents

makesymbols()

Usage:
plotsymbols(intVar), intVar a REAL variable with integer elements
  between 1 and 255
plotsymbols(charVar [,medium:T or small:T]), charVar a CHARACTER
  variable of shape names "diamond", "plus", "square", "cross",
  "triangle", "star", "dot" or "circle"



Keywords: character variables, plotting
makesymbols(intVar), where intVar is a REAL scalar, vector, matrix or
array whose elements are integers between 1 and 255 returns a CHARACTER
variable with the same size and shape as intVar.  Each element of intVar
is interpreted as an ASCII code and the corresponding element of the
result is the single character with that code.

  Cmd> symbols <- makesymbols(vector(2,29,65,97)); symbols
  (1) "\002"            [octal representation of 2]
  (2) "\035"            [octal representation of 29]
  (3) "A"               [ASCII code 65]
  (4) "a"               [ASCII code 97]

makesymbols(charVar), where charVar is a CHARACTER scalar, vector,
matrix or array, also returns a CHARACTER variable the same size and
shape as charVar.  Any element of charVar whose first three characters
match the first three letters of "diamond", "plus", "square", "cross",
"triangle", "star", "dot" or "circle", is replaced in the result by
"\001", "\002", "\003", "\004", "\005", "\006", "\007", or "\010",
respectively.  These are the plotting symbol codes for these shapes.
Any elements of charVar not specifying one of these shapes are put in
the result without change.

  Cmd> makesymbols(vector("diamond","dot","circle"))
  (1) "\001"
  (2) "\007"
  (3) "\010"

symbols <- makesymbols(charVar, medium:T) does the same except the shape
names are translated to "\011", "\012", "\013", "\014", "\015",
"\016", "\017", or "\020".

symbols <- makesymbols(charVar, small:T) does the same except the shape
names are translated to "\021", "\022", "\023", "\024", "\025",
"\026", "\027", or "\023".

See subtopic "chplot:drawn_plotting_symbols" for more information about
plotting symbols.  In particular, in specifying these symbols
explicitly, leading 0's can be omitted, so chplot(x,y,symbols:"\7") is
the same as chplot(x,y,symbols:"\007").

makesymbols() is designed to be used to create a CHARACTER vector or
matrix to be used as the value of keyword 'symbols' on plotting commands
such as plot(), chplot() and addchars().  For this usage the dimensions
of intVec and charVec must match what is expected.  See subtopic
"chplot:symbol_variable_shape" for details.

Examples:
In the following, x is a vector and y a matrix with 3 columns:

  Cmd> plot(x,y[,1],symbols:makesymbols("diamond"))#or makesymbols(1)

plots column 1 of y using diamonds (code "\001") as plotting symbol.

  Cmd> lineplot(x,y, symbols:makesymbols(vector("dia","plus","squ"),\
       medium:T))

  Cmd> lineplot(x,y, symbols:makesymbols(9, 10, 11))

  Cmd> lineplot(x,y, symbols:vector("\11", "\12", "\13"))

all make line plots of the columns of y, with medium sized diamonds,
plus signs and squares used as plotting symbols for each columns

When intVar is a vector, the usage makesymbols(intVar) is somewhat
similar to putascii(intVar, keep:T) since both translate ASCII codes to
characters.  The difference is that putascii() returns a CHARACTER
scalar with length(intVar) characters while makesymbols() returns a
CHARACTER vector of length(intVar), with each element a single
character.

See also topics chplot(), 'plotting', putascii().


Gary Oehlert 2003-01-15