I have problems labelling my x-axis when I nplot the state-distribution by time points in sequence analysis using seqdplot() from the package TraMinR. The labelling works with other plotting functions like seqiplot
. I can label the x-axis later with title(xlab="")
however I don't know how this works when my sequences are grouped e.g. by gender. Am I missing something what makes the seqdplot function special? Thanks for your help!
Here is an example
library(TraMineR)
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)
# Index plot: labelling works
seqiplot(mvad.seq, with.legend=F, xlab="time")
# State Distribution Plot: labelling doesn't work
seqdplot(mvad.seq, with.legend=F, xlab="time")
This is actually a bug. The plot method plot.stslist.statd
invoked by seqdplot
ignored the xlab
argument.
The bug has been fixed in the development version 2.3-1 available on R-Forge. This development version will eventually become TraMineR 2.2.1 on the CRAN.
About the grouping mechanism: TraMineR uses layout
to organize the groups. To use title(xlab="time")
with grouping, you would have to create the grouped plot manually, which can be fastidious.