Plot a legend for the states in a sequence object
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, fontsize, ...)
seqdata |
a sequence object as returned by the the |
with.missing |
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 |
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. |
fontsize |
Deprecated. Use |
... |
optional arguments passed to the |
Alexis Gabadinho
## Loading the 'actcal' example data set ## and defining a sequence object with ## (activity statuses from jan. to dec. 2000) ## the data in columns 13 to 24 data(actcal) actcal.seq <- seqdef(actcal,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, idxs=0, with.legend=FALSE, border=NA, space=0) seqfplot(actcal.seq, pbarw=TRUE, with.legend=FALSE) seqdplot(actcal.seq, with.legend=FALSE) seqlegend(actcal.seq)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.