Next: plotpanes() Up: Graphics Macros Help File Previous: piechart()   Contents


plotmatrix(x [, symbols:syms] [,bottomup:T] [,upper:T  or  lower:T]\
  [,hstrip:h] [,vstrip:v] [,labels:labsx or nolabels:T] \
  [,diaglabs:F] [,name:xname] [,graphics keyword phrases]),
  x REAL matrix, ncols(x) > 1, CHARACTER scalar or vector labsx,
  CHARACTER  scalar xname
plotmatrix(x, y [, symbols:syms] [,bottomup:T] [,hstrip:h] [,vstrip:v]\
  [,labels:structure(labsx,labsy) or nolabels:T]\
  [,names:vector(xname,yname)] [,graphics keyword phrases]), x, y REAL
  matrices with same number of rows, labsx and labsx CHARACTER scalars
  or vectors, xname and yname CHARACTER scalars
For both usages, h > 0, v > 0 are integers, syms is a CHARACTER or
  non-negative integer vector

Keywords: multivariate graphs, panel graphs
plotmatrix(x) makes scatter plots of every column of REAL matrix x
against every other column in the panes of a panel graph (see topic
'panel_graphs').  When x has nx columns, the plot is a nx by nx array
of panes, with no graphs on the diagonals.

When x has labels (see topic 'labels'), the column labels are printed
in the diagonal boxes.  Otherwise, "X1", "X2",...  are used as labels.
Column numbers increase down the y axis and across the x axis.

plotmatrix(x, diaglabels:F) does the same except the labels are in
the margins rather than the diagonals.

plotmatrix(x, upper:T) and plotmatrix(x lower:T) do the same except
only the plots in the upper or lower triangle of the display are drawn
in a nx-1 by nx array of plots.  Labels are put in the margins.  You
can't use both 'upper:T' and 'lower:T'.

plotmatrix(x,y), where x and y are REAL matrices with the same number
of rows and nx and ny columns, makes a similar plot of every column of
y against every column of x in a ny by nx array of small plots.
Column labels of x and/or y (default "X1","X2",... and "Y1","Y2",...)
are printed in the margins.

plotmatrix(x,y) differs from plotpanes(x,y) in that the latter plots
column j of y only against column j of x, and not all against all
columns of x.

plotmatrix(x [,y], symbols:syms ...), where syms is a CHARACTER scalar
or vector or an integer scalar or vector with values between 0 and 999
uses 'syms' as plotting symbols similarly to chplot().  The default
plotting symbols are "\7", the code for a dot.  Small plotting symbols
(ascii codes 7 and 17 - 24, that is, "\7' and "\21" - "\30") are
recommended.  'symbols:syms' can be used with any other keywords.

plotmatrix(x [,y], bottomup:T ...) does the same, except that column
numbers increase up the y axis.  'bottomup:T' can be used with any
other keywords.

plotmatrix(x [,y], labels:labs ...) does the same, except column
labels are taken from labs.  With just x, labs should be a CHARACTER
scalar or vector labsx.  With x and y, labs should be structure(labsx,
labsy), where labsx and labsy are CHARACTER scalars or vectors.
When labsx or labsy are scalars, they are expanded by appending "1",
"2", ....  When they are vectors, their length must match the number
of columns of x and y.

plotmatrix(x [,y], nolabels:T ...) does the same except no variable
labels are added to the plot.

plotmatrix(x [,y], name:Name ...), does the same, except that
CHARACTER variable Name is used in constructing a title and axis
labels.  With just x, Name should a scalar; with x and y, Name should
be a vector of length 2.

plotmatrix(x [,y], hstrip:h, vstrip:v ...) does the same, except that
the overall array of small plots will be h by v, where h and v are
positive integers.  It is an error if h or v is too small to allow all

You can use many of the usual graphics keywords phrases with
plotmatrix(), including 'symbols', 'window', 'show', 'title', 'xlab',
'ylab', 'xaxis', 'yaxis', 'lines', 'linetype' and keywords related to
files.  See topic 'graph_keys'. Values for 'xmin', 'xmax', 'ymin' and
'ymax' may be vectors with lengths matching the appropriate number of

You cannot use keywords 'add', 'logx', 'logy', 'impulses', and keywords
related to tick marks.

  Cmd> irisdata <- matread("macanova.dat","irisdata") #Fisher data

  Cmd> # col 1 is variety number, 2 - 5 are data

  Cmd> colnames <- vector("SepLen","SepWid","PetLen","PetWid")

  Cmd> plotmatrix(irisdata[,-1],lower:T,name:"Iris Data",\
    symbols:vector("\21","\22","\23")[irisdata[,1]], labels:colnames)

  Cmd> plotmatrix(irisdata[,run(2,3)],irisdata[,run(4,5)],bottomup:T,\
    names:vector("Iris Cols 1,2","Iris Cols 3,4"),\

See also topics 'graphs', plot(), lineplot(), chplot().

Gary Oehlert 2003-01-15