lattice/seqplot group colors

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

lattice/seqplot group colors

Dieter Menne
I am trying to get segplot honor the groups parameter like barchart does. The below give an incorrect display for segplot.

Any help?

Dieter

# seqplot bar coloring
library(latticeExtra)
d = data.frame(acid=letters[1:10],lwr=rnorm(10),
               essential=rep(c(TRUE,FALSE),each=5))
d$upr = d$lwr+1

# Works as expected
barchart(acid~lwr,data=d,
         groups=essential,
         par.settings=list(plot.polygon=list(col=c("red","blue"))))

# looks like groups not used
segplot(acid~lwr+upr,data=d,
        groups=essential,
        par.settings=list(plot.polygon=list(col=c("red","blue"))))


Reply | Threaded
Open this post in threaded view
|

Re: lattice/seqplot group colors

Dieter Menne
Found it. Use level instead of groups.

# seqplot bar coloring
library(latticeExtra)
d = data.frame(acid=letters[1:10],lwr=rnorm(10),
               essential=rep(c(TRUE,FALSE),each=5))
d$upr = d$lwr+1

# Works as expected
barchart(acid~lwr,data=d,
         groups=essential,
         par.settings=list(plot.polygon=list(col=c("red","blue"))))

# looks like groups not used
segplot(acid~lwr+upr,data=d,
        level=essential,
        par.settings=list(plot.polygon=list(col=c("red","blue"))))