plot.stslist.rep {TraMineR} | R Documentation |
This is the plot method for output produced by the seqrep function, i.e objects of class stslist.rep. It produces a representative sequence plot.
## S3 method for class 'stslist.rep': plot(x, cpal = NULL, pbarw = TRUE, dmax = NULL, ylab = NULL, xaxis = TRUE, xtlab = NULL, cex.plot = 1, ...)
x |
an object of class stslist.rep as produced by the seqrep 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 x object is
used. |
pbarw |
when TRUE , the bar heights are set proportional to the number of represented sequences. |
dmax |
maximal theoretical distance, used for the x axis limits. |
ylab |
an optional label for the y axis. If set to NA, no label is drawn. |
xaxis |
controls whether a x axis is plotted. |
xtlab |
optional labels for the x axis ticks labels. If unspecified, the column names of the object being 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. |
... |
further graphical parameters. For more details about the graphical parameter arguments, see barplot and par . |
This is the plot method for the output produced by the seqrep
function, i.e. objects of class stslist.rep.
It produces a plot where the representative sequences are displayed as horizontal bars with width proportional to the
number of sequences assigned to them. Sequences are plotted bottom-up according to their representativeness score.
Above the plot, two parallel series of symbols associated to each representative are displayed horizontally on a scale ranging
from 0 to the maximal theoretical distance D_max. The location of the symbol associated to the representative r_i
indicates on axis A the (pseudo) variance (V_i) within the subset of sequences assigned to r_i and on the axis B
the mean distance MD_i to the representative.
This method is called by the generic seqplot
function (if type="r"
) that produces more sophisticated
plots with group splits and automatic display of the color legend. The seqrplot
function is a shortcut for
calling seqplot
with type="r"
.
Gabadinho, A., G. Ritschard, M. Studer and N. S. Müller (2009). Summarizing Sets of Categorical Sequences, In International Conference on Knowledge Discovery and Information Retrieval, Madeira, 6-8 October, INSTICC.
## 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 optimal matching distances submat <- seqsubm(mvad.seq, method= "TRATE") dist.om1 <- seqdist(mvad.seq, method="OM", indel=1, sm=submat) ## Extracting a representative set using the sequence frequency ## as a representativeness criterion mvad.rep <- seqrep(mvad.seq, dist.matrix=dist.om1) ## Plotting the representative set plot(mvad.rep)