addStates {mhsmm}R Documentation

Adds a bar representing state sequence.

Description

Add a colour coded horizontal bar representing the state sequence to a plot of (presumably time-series) data.

Usage

addStates(states, x=NULL,ybot = axTicks(2)[1],
          ytop=ybot + (axTicks(2)[2] - axTicks(2)[1])/5,dy  = ytop - ybot,
          greyscale = FALSE,leg = NA, J = length(unique(states)), time.scale = 1, 
          shiftx = 0)

Arguments

states

A vector of integers representing the states traversed

x

The time values where the states are observed ((1:length(states)-shiftx)/time.scale if NULL)

ybot

Vertical bottom limit of the bar.

ytop

Vertical top limit of the bar.

dy

Height of the bar.

greyscale

If TRUE produces a bar in greyscale.

leg

Array of state names, if present, produces a legend.

J

Number of states

time.scale

Resolution of the timescale

shiftx

Shift the bar forward or backwards horizontal by shiftx distance.

Author(s)

Soren Hojsgaard sorenh@math.aau.dk

See Also

addStates

Examples

  plot(rnorm(100),type='l')
  addStates(rep(c(1,2),each=50))  

  plot(seq(0.01,1,.01),rnorm(100),type='l')
  addStates(rep(c(1,2),each=50),seq(0.01,1,.01))  

[Package mhsmm version 0.4.21 Index]