Learn R Programming

TraMineR (version 1.8-9)

plot.stslist.meant: Plot method for objects produced by the seqmeant function

Description

This is the plot method for objects of class stslist.meant produced by the seqmeant function.

Usage

## S3 method for class 'stslist.meant':
plot(x, cpal = NULL, ylab = NULL, yaxis = TRUE, xaxis = TRUE,
     cex.plot = 1, ylim = NULL, ...)

Arguments

x
an object of class stslist.meant as produced by the seqmeant function.
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 states in the alphabet. By default, the 'cpal' attribute of the 'seqdata' sequence object is us
ylab
an optional label for the y axis. If set to NA, no label is drawn.
yaxis
controls whether the y axis is plotted. Default is TRUE.
xaxis
if TRUE (default) the xaxis is plotted.
cex.plot
expansion factor for setting the size of the font for the axis labels and names. The default value is 1. Values lesser than 1 will reduce the size of the font, values greater than 1 will increase the size.
ylim
an optional vector setting the limits for the y axis. If NULL (default), limits are set to (0, max. sequence length).
...
further graphical parameters. For more details about the graphical parameter arguments, see barplot and par.

Details

This is the plot method for the output produced by the seqmeant function, i.e., objects of class stslist.meant. It produces a plot showing the mean times spent in each state of the alphabet. This method is called by the generic seqplot function (if type="mt") that produces more sophisticated plots, allowing grouping and automatic display of the states legend. The seqmtplot function is a shortcut for calling seqplot with type="mt".

Examples

Run this code
## Loading the mvad data set and creating a sequence object
data(mvad)
mvad.labels <- c("employment", "further education", "higher education",
                    "joblessness", "school", "training")
mvad.scodes <- c("EM","FE","HE","JL","SC","TR")
mvad.seq <- seqdef(mvad, 15:86, states=mvad.scodes, labels=mvad.labels)

## Computing the mean times
mvad.meant <- seqmeant(mvad.seq)

## Plotting
plot(mvad.meant, main="Mean durations in each state of the alphabet")

## Changing the y axis limits
plot(mvad.meant, main="Mean durations in each state of the alphabet",
 ylim=c(0,40))

Run the code above in your browser using DataLab