seqlegend | R Documentation |
Plots a legend for the states in a sequence object. Useful if several graphics are plotted together and only one legend is necessary. Unless specified by the user, the cpal and labels attributes of the sequence object are used for the colors and text appearing in the legend (see seqdef
).
seqlegend(seqdata, with.missing = "auto", cpal = NULL, missing.color = NULL,
ltext = NULL, position = "topleft", cex = 1, boxes=TRUE, fontsize, ...)
seqdata |
a state sequence object (of class |
with.missing |
logical: if set to |
cpal |
alternative color palette to use for the states. If user specified, a vector of colors with number of elements equal to the number of distinct states. By default, the 'cpal' attribute of the 'seqdata' sequence object is used (see |
missing.color |
alternative color for representing missing values inside the sequences. By default, this color is taken from the "missing.color" attribute of the sequence object being plotted. |
ltext |
optional description of the states to appear in the legend. Must be a vector of character strings with number of elements equal to the number of distinct states. If unspecified, the 'labels' attributes of the 'seqdata' sequence object is used (see |
position |
the position of the legend in the graphic area. For accepted values, see the |
cex |
size of the font for the labels. A value less than 1 decreases the font size, a value greater than 1 increases the font size. Defaults to 1. |
boxes |
logical: should the colors be displayed in small square boxes? Default is |
fontsize |
Deprecated. Use |
... |
optional arguments passed to the |
When x
, legend
, or col
arguments are provided, they supersede respectively the position
, ltext
, and cpal
values.
Coordinate values returned by the legend
function.
Alexis Gabadinho and Gilbert Ritschard
## Loading the 'actcal' example data set
## and defining a sequence object with
## activity statuses from Jan. to Dec. 2000 (columns 13 to 24)
## of first 100 cases.
data(actcal)
actcal.seq <- seqdef(actcal[1:100,13:24],
labels=c("> 37 hours", "19-36 hours", "1-18 hours", "no work"))
## Plotting the sequences frequency,
## the states distribution
## and the legend
par(mfrow=c(2,2))
seqIplot(actcal.seq, sortv="from.start", with.legend=FALSE)
seqfplot(actcal.seq, pbarw=TRUE, with.legend=FALSE)
seqdplot(actcal.seq, with.legend=FALSE)
seqlegend(actcal.seq)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.