Skip to content
Prev 245045 / 398503 Next

Problems drawing a colored 'rug' in the Lattice 'densityplot'

Mark -
    If I understand what you want, it can be done with a custom
panel function:

mypanel = function(x,subscripts,groups,...){
   panel.densityplot(x,plot.points=FALSE,groups=groups,subscripts=subscripts,...)
   panel.rug(x,col=trellis.par.get('superpose.line')$col[groups[subscripts]])
}

Then I think you'll get the result you want if you use

densityplot(~Value|Type, group=Category, data=d, panel=mypanel)

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu
On Thu, 16 Dec 2010, Mark Dalphin wrote: