Search code examples
rbioinformaticsr-grid

R and Gviz: How to remove (/crop) a region of a plot?


This code:

alTrack <- Gviz::AlignmentsTrack(
  system.file(package = "Gviz", "extdata", "gapped.bam"),
  isPaired = TRUE)

Gviz::plotTracks(
  alTrack,
  from = 3048500,
  to = 3049000,
  chromosome = "chr12")

Produces this plot:

enter image description here

Using the Gviz package. My problem is the empty space that's always appearing in the bottom of the picture. How can I remove a specific region of this plot / crop to only keep the region I need? If I could remove the lower 15% of a produced plot with an R function that would be great.

The specific region I want to not appear:

enter image description here


Solution

  • The max.height parameter will do it.

    Already answered here: https://support.bioconductor.org/p/81044/