Question: Gviz AnnotationTrack id above feature
gravatar for bruce.moran
23 months ago by
bruce.moran20 wrote:


hoping one of the Gviz team can help me with this (mostly so I can thank you for the really flexible package!).

Example data:

cpgGR <- makeGRangesFromDataFrame(data.frame(chrom = c(1,1), start = c(23884842, 23885682), end = c(23885087, 23886212)))
ids <- c("CpG:23", "CpG:49")
cpgTrack <- AnnotationTrack(cpgGR, id = ids, name = "CpG Islands",  showID = TRUE, genome = "hg19", cex = .6, fill = "lightgreen", fontcolor = "black", = "above")

plotTracks(list(cpgTrack),  legend = TRUE, showFeatureId = TRUE, = "above")


But this does not either make the text black, nor place the IDs above the feature. I believe this to be possible, can someone specify how?


Many thanks,



> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

[1] en_IE.UTF-8/en_IE.UTF-8/en_IE.UTF-8/C/en_IE.UTF-8/en_IE.UTF-8

attached base packages:
 [1] grid      parallel  stats4    stats     graphics  grDevices utils
 [8] datasets  methods   base

other attached packages:
 [1] coMET_1.6.0          trackViewer_1.10.2   psych_1.7.3.21
 [4] biomaRt_2.30.0       biovizBase_1.22.0    ggbio_1.22.3
 [7] ggplot2_2.2.1        AnnotationHub_2.6.4  Gviz_1.18.1
[10] GenomicRanges_1.26.2 GenomeInfoDb_1.10.2  IRanges_2.8.1
[13] S4Vectors_0.12.1     BiocGenerics_0.20.0


annotation gviz gviz-package • 772 views
ADD COMMENTlink modified 23 months ago by florian.hahne@novartis.com1.6k • written 23 months ago by bruce.moran20
Answer: Gviz AnnotationTrack id above feature
gravatar for
23 months ago by

How about this:

plotTracks(list(cpgTrack),  legend = TRUE, groupAnnotation="id", = "above")
ADD COMMENTlink written 23 months ago by florian.hahne@novartis.com1.6k

Thanks Florian, much appreciated!


ADD REPLYlink written 23 months ago by bruce.moran20
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 252 users visited in the last hour