Fill the color in a graph in a reverse scale - gtrellis
0
0
Entering edit mode
@vinicius-henrique-da-silva-6713
Last seen 19 months ago
Brazil

   I would like to fill the graph within the polygons instead out of it. 

    library(gtrellis)
    library(circlize)
 
    tiff("plot.tiff", units="in", width=11, height=8.5, res=300, compress = "lzw")

    load(system.file("extdata", "DMR.RData", package = "circlize"))
    DMR_hyper_density = circlize::genomicDensity(DMR_hyper, window.size = 1e7)
    head(DMR_hyper_density)
    
    gtrellis_layout(n_track = 4, ncol = 4, byrow = FALSE,
        track_axis = c(FALSE, TRUE, TRUE, FALSE), 
        track_height = unit.c(2*grobHeight(textGrob("chr1")), 
                              unit(1, "null"), 
                              unit(0.5, "null"), 
                              unit(3, "mm")), 
        track_ylim = c(0, 1, 0.013, 0, 0, 0.013, 0, 1),
        track_ylab = c("", "log10(inter_dist)", "density", ""))
    # track for genomic density
    add_lines_track(DMR_hyper_density, DMR_hyper_density[[4]], area = TRUE, 
      gp = gpar(fill = "pink", bg="pink"))
    add_lines_track(DMR_hyper_density, DMR_hyper_density[[4]], area = TRUE, 
      gp = gpar(fill = "pink"))

    dev.off()

Please not that the track containing the graph is in a reverse scale (It starts from the track top - from 0.013 to 0). I tried to use `bg` with `fill` in the `gp` in one track trying to achieve the desired effect without success. 

Some idea how to fill within the line with pink in a reverse scale like that?

 

gtrellis • 1.0k views

Login before adding your answer.

Traffic: 465 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6