문제

I am battling to define the y-axis of a plot using seqmtplot. I followed the steps described in a previous post (How to configure y-axis using seqIplot in R?). However, they do not seem to work for seqmtplot.

The y axis of my plot goes from 0 to 9, so I want it to disply tick marks in intervals of 1 i.e. 0, 1, 2...9

I am running these lines of code.

seqmtplot(LSAY.seq, group= , title="Mean time", yaxis=F) 
#axis(2, at=seq(from=0, to=9, by=1))

The problem with this is that the starting point of the y axis (i.e. 0) of my plot moved below the bars displaying the data.

Any ideas how could I fix this?

A second associated question is: how can I access the data underlaying the plot produced by seqmtplot?

Thanks in advance.

도움이 되었습니까?

해결책

You can control the length of the y axis with ylim=. For instance using the mvad.seq state sequences defined in How to configure y-axis using seqIplot in R?

seqmtplot(mvad.seq, title="Mean time", ylim=c(0,30)) 

For controlling the tick marks, you need, as already explained in How to configure y-axis using seqIplot in R?, to

  1. Disable the plotting of the y-axis with yaxis=FALSE
  2. Disable the legend with withlegend=F.

and you should then plot the legend separately. For example:

par(mfrow=c(1,2))
seqmtplot(mvad.seq, title="Mean time", yaxis=F, ylim=c(0,30), withlegend=FALSE) 
axis(2, at=seq(from=0, to=30, by=5))
seqlegend(mvad.seq)

The data plotted are accessible with

seqmeant(mvad.seq)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top