I wanted to know if it was possible to rotate the ytlab
in a seqIplot
in TraMineR
. I also get a warning message when I try to use the row.names
of the sequence.
The data :
mc = structure(c(1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0,
0, 0, 0, 0, 2, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 0, 0, 0, 0,
0, 0, 1, 1, 1, 2, 1, 1, 0, 0, 0, 0), .Dim = c(10L, 5L), .Dimnames = list(
c("d Travel/Commute", "j Care for others", "r Religious",
"u Others", "e Cooking", "f Housework", "h Eating", "l Leisure",
"t TV/Radio", "o Telephone/Online Communication"), c("V1",
"V2", "V3", "V4", "V5")))
The sequence
sq = seqdef(mc, cpal = heat.colors(3))
The Iplot
seqIplot(sq, border = NA, ytlab = attributes(sq)$row.names, las = 2)
the las = 2
argument is apparently not working.
You have to use axis()
to specify on which axis las
applies.
Also you need to specify the points at which you want the tick marks. The seqIplot
uses a 0-1 scale and makes some adjustment at the start. Moreover, to rotate the labels, you have to spare some place with par(mar=...)
.
Here is how you can get rotated labels for your example:
step = nrow(mc)+3
par(mar=c(5,20,2,2))
seqIplot(sq, border = NA, ylab=NA, ytlab=FALSE)
axis(2, at=2.15/step + 1:10*(1/step), labels=rownames(sq), las = 2)
Hope this helps.