Star Plots of Multivariate Data
DESCRIPTION:
Creates star plots from a matrix of multivariate data.
Options are available to control the type of star produced and the
layout of the stars.
USAGE:
stars(x, full=T, scale=T, radius=T, type="l", labels=<<see below>>,
head=<<see below>>, max=<<see below>>, byrow=F,
nrow=<<see below>>, ncol=<<see below>>)
REQUIRED ARGUMENTS:
- x
-
matrix of data. One star symbol will be produced for
each row of the matrix.
Missing values (
NAs) are allowed, but they are treated as if they were
0.
OPTIONAL ARGUMENTS:
- full
-
logical flag: if
TRUE, the symbols will occupy a full circle.
Otherwise, they occupy the (upper) semi-circle only.
- scale
-
logical flag: if
TRUE, the columns of the data matrix are scaled
independently so that the maximum value in each column is
1 and the
minimum is
0. If
FALSE, the presumption is that the data have
been scaled by some other algorithm to the range
`0<=x[i,j]<=1'.
- radius
-
logical flag: if
TRUE, the radii corresponding to each variable
in the data will be drawn.
- type
-
character string, giving the type of star to draw.
Reasonable values are
"l",
"p",
"b" for lines, points and
both.
- labels
-
vector of character strings for labeling the plots.
If omitted, the first component of
dimnames(x) is used, if available;
otherwise, labels are
"1",
"2", etc. If supplied, the label
vector must have length equal to
nrow(x).
- head
-
character string for a running head. This is
plotted as a title at the top of each page. By default, the
name of the data is used. If there is more than one page,
the page number is included in the title.
- max
-
suggested limit for the number of rows or columns
of plots on a single page.
The algorithm tries
to choose an array of plots which efficiently uses the
available space on the display.
The default forces all symbols to be on one page.
- byrow
-
logical flag: should the symbols be plotted row-by-row across the
page, or column-by-column?
- nrow,ncol
-
may be given to specify exactly the number of rows
and columns for the array of plots on each page.
Graphical parameters may also be supplied as arguments to
this function (see
par
).
SIDE EFFECTS:
one or more pages of star plots are created on the current graphics device.
DETAILS:
Missing values are treated as
0.
Each star represents one row of the input
x.
Variables (columns) start on the right and wind counterclockwise around the
star.
The size of a (scaled) column is shown by the distance from the center
to the point on the star representing the variable.
SEE ALSO:
symbols
,
starsymb
,
faces
.
EXAMPLES:
# The stars() function is roughly equivalent to the following
# function, which you can customize.
my.stars <-
function(x, labels = dimnames(x)[[1]], nrow =
floor(sqrt(dim(x)[1])), ncol = ceiling(dim(x)[1]/nrow))
{
opar <- par(mar = c(2, 0, 0, 0), mfcol = c(nrow, ncol))
on.exit(par(opar))
for(i in 1:dim(x)[1]) {
starsymb(x, collab = rep("", dim(x)[2]), sample = i)
if(!is.null(labels))
mtext(text = labels[i], side = 1, line = 0, cex = 1)
}
}
stars(votes.repub[state.region==1,]/100, radius=T, scale=F,
head="Republican Votes (Northeast) 1856 - 1976")