So I have a dotplot with 4 panels, each panel has 6 horizontal bars. I'm trying to make it so that when a bar is past a certain X value (denoted by reference line), it will be a different color. I cant find anything that will make R do this automatically, soI figured there must be a way to manually tell it to make a specific row of a specific panel a certain color? Heres my code:
dotplot(somematrix,groups=FALSE,
layout=c(2,2),aspect=1,
origin=0,type=c("p","h"),
main="Main label",
xlab="X label",
scales=list(x=list(tck=0, alternating=TRUE)),
panel=function(...){
panel.fill(rgb(.9,.9,.9))
panel.grid(h=0,v=-1,col="white",lwd=2)
panel.abline(v=20,col="red",lwd=3)
panel.barchart(col=c("blue","blue","blue","blue","red","blue"),cex=1.1,...)
}
)