How can I colour boxes in Gviz AnnotationTrack in R?

I'm learning the Gviz bioconductor package, I generate a plot as follows:

library(Gviz)
track <- AnnotationTrack(start=c(1,5,7), end=c(2,6,10), strand=c('*','*','*'), stacking="dense", showFeatureId=TRUE, id=c('red','blue', 'red'))
pdf(file=paste("test","pdf", sep="."))
plotTracks(track)
dev.off()


test.pdf looks like this:

However, what I want is for the boxes to be coloured rather than labelled with the colour word, how to do this?

Note that my real example is much more complex than this.

Did you try the fill argument?
track <- AnnotationTrack(start=c(1,5,7), end=c(2,6,10), strand=c('*','*','*'), stacking="dense", showFeatureId=TRUE, id=c('red','blue', 'red'), fill=c('red','blue', 'red'))

• Thanks, seems to work, can't believe I missed that! What colours are accepted as arguments for fill? – Chris_Rands Nov 15 '17 at 10:08
• @Chris_Rands see ?plotTracks for the options accepted by plotTracks which will then refer you to ?settings for the various things you can tweak (long, long documentation). Finally, availableDisplayPars(track) will show you what you can set for track. – terdon Nov 15 '17 at 10:59