7
$\begingroup$

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: enter image description here

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.

$\endgroup$
8
$\begingroup$

Did you try the fill argument?

Something like this:

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'))
$\endgroup$
  • 1
    $\begingroup$ Thanks, seems to work, can't believe I missed that! What colours are accepted as arguments for fill? $\endgroup$ – Chris_Rands Nov 15 '17 at 10:08
  • $\begingroup$ Probably all colors, here a list of color names. $\endgroup$ – benn Nov 15 '17 at 10:11
  • $\begingroup$ @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. $\endgroup$ – terdon Nov 15 '17 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.