How to configure y-axis using seqIplot in R?

后端 未结 1 734
长发绾君心
长发绾君心 2020-12-20 01:32

I am trying to configure the y-axis of a sequence index plot using the R-package TraMineR, I figured out how to set a global limit for the y-axis which is helpf

相关标签:
1条回答
  • 2020-12-20 01:34

    When a ylim is given in seqIplot, it is used for all groups. To make the plot heights proportional to the weighed number of sequences in each group, the upper ylim should be set as the value for to the most frequent group.

    group <- mvad$gcse5eq
    (nseq <- xtabs(mvad$weight ~ group))
    (nmax <- max(nseq))
    seqIplot(mvad.seq, group=group, withlegend=TRUE,
             border=NA, xtstep=3, sortv="from.start",
             ylim=c(0, nmax) )
    

    The tick labels on the y axis are sequence indexes. You can suppress them with by giving yaxis = FALSE to seqIplot. To display your own labels you can then issue something like (see the help of the axisfunction for details)

    axis(2, at = c(1, nseq[1]))
    

    but in that case you should generate the seqIplot separately for each group with withlegend=FALSE and organize the plots yourself in a single graphic with layout or par(mfrow=...).

    0 讨论(0)
提交回复
热议问题