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

View source: R/plot.stslist.meant.R

plot.stslist.meantR Documentation

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.axis = par("cex.axis"), ylim = NULL, bar.labels = NULL,
  cex.barlab = cex.axis, offset.barlab = .1, cex.plot, ...)

Arguments

x

object of class stslist.meant as produced by the seqmeant function.

cpal

vector of colors of length the number of states in the alphabet. If NULL (default), the 'cpal' attribute of the 'seqdata' sequence object is used (see seqdef).

ylab

optional label of the y-axis. If set to NA, no label is drawn.

yaxis

should the y-axis be plotted. Default is TRUE.

xaxis

should the x-axis be plotted. Default is TRUE.

cex.axis

Tick labels magnification. See par.

ylim

optional vector of length 2 setting the limits of the y-axis. If NULL (default), limits are set to (0, max. sequence length).

bar.labels

Vector of bar labels of length equal to size of alphabet.

cex.barlab

Real. Bar labels magnification. Defaults to cex.axis

offset.barlab

Real. Vertical offset of bar labels as a proportion of max(ylim). Default is 0.1.

cex.plot

Deprecated. Use cex.axis instead.

...

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.

When the "se" attribute of x is TRUE, i.e., when x contains also the standard errors of the mean times, error bars are automatically displayed on the plot. See the serr argument of seqmeant.

The method is invoked by seqmtplot (seqplot with type="mt"), which plots mean times with automatic display of the state color legend and allows plotting by group.

Examples

## 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))

## Displaying error bars
mvad.meant.e <- seqmeant(mvad.seq, serr=TRUE)
plot(mvad.meant.e, main="Mean durations in each state of the alphabet",
 ylim=c(0,40))


TraMineR documentation built on May 29, 2024, 5 a.m.