<p>It seems like the ggbio object already contains the corresponding ggplot object.
You should be able to extract the ggplot from the <code>ggbio_obj@ggplot</code> slot and extract your gtables.</p>
<p>Small example:</p>
<pre class="lang-r prettyprint-override"><code>library(ggbio)
library(ggplot2)
library(patchwork)

fl.bam &lt;- system.file(&quot;extdata&quot;, &quot;wg-brca1.sorted.bam&quot;, package = &quot;biovizBase&quot;)
wh &lt;- as(c(&quot;chr17:41239394-41319151:+&quot;), &quot;GRanges&quot;)
p_cov &lt;- autoplot(fl.bam, which = wh)
#&gt; reading in as Bamfile
#&gt; Parsing raw coverage...
#&gt; Read GAlignments from BamFile...
#&gt; extracting information...


df &lt;-  data.frame(x= sample(1:100,size = 100,replace = TRUE))
p_hist &lt;- ggplot(df) + 
    geom_histogram(aes(x))


p_hist / p_cov
#&gt; Error: Can't add `e2` to a ggplot object.
#&gt; Backtrace:
#&gt;     █
#&gt;  1. └─patchwork:::`/.ggplot`(p_hist, p_cov)
#&gt;  2.   └─GGally:::`+.gg`(e1, e2)
#&gt;  3.     └─e1 %+% e2
#&gt;  4.       └─ggplot2:::add_ggplot(e1, e2, e2name)
#&gt;  5.         ├─ggplot2::ggplot_add(object, p, objectname)
#&gt;  6.         └─ggplot2:::ggplot_add.default(object, p, objectname)

p_hist / p_cov@ggplot
#&gt; `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
</code></pre>
<p><img src="https://i.sstatic.net/tOPJq.png" alt="" /></p>
<p><sup>Created on 2021-02-05 by the <a href="https://reprex.tidyverse.org" rel="nofollow noreferrer">reprex package</a> (v1.0.0)</sup></p>
Session info
<p>
<pre class="lang-r prettyprint-override"><code>sessioninfo::session_info()
#&gt; ─ Session info ───────────────────────────────────────────────────────────────
#&gt;  setting  value                       
#&gt;  version  R version 3.6.0 (2019-04-26)
#&gt;  os       Red Hat Enterprise Linux    
#&gt;  system   x86_64, linux-gnu           
#&gt;  ui       X11                         
#&gt;  language (EN)                        
#&gt;  collate  en_US.UTF-8                 
#&gt;  ctype    en_US.UTF-8                 
#&gt;  tz       Europe/Berlin               
#&gt;  date     2021-02-05                  
#&gt; 
#&gt; ─ Packages ───────────────────────────────────────────────────────────────────
#&gt;  package              * version  date       lib source        
#&gt;  acepack                1.4.1    2016-10-29 [1] CRAN (R 3.6.0)
#&gt;  AnnotationDbi          1.48.0   2019-10-29 [1] Bioconductor  
#&gt;  AnnotationFilter       1.10.0   2019-10-29 [1] Bioconductor  
#&gt;  askpass                1.1      2019-01-13 [1] CRAN (R 3.6.0)
#&gt;  assertthat             0.2.1    2019-03-21 [1] CRAN (R 3.6.0)
#&gt;  backports              1.1.8    2020-06-17 [1] CRAN (R 3.6.0)
#&gt;  base64enc              0.1-3    2015-07-28 [1] CRAN (R 3.6.0)
#&gt;  Biobase                2.46.0   2019-10-29 [1] Bioconductor  
#&gt;  BiocFileCache          1.10.2   2019-11-08 [1] Bioconductor  
#&gt;  BiocGenerics         * 0.32.0   2019-10-29 [1] Bioconductor  
#&gt;  BiocManager            1.30.10  2019-11-16 [1] CRAN (R 3.6.0)
#&gt;  BiocParallel           1.20.1   2019-12-21 [1] Bioconductor  
#&gt;  biomaRt                2.42.1   2020-03-26 [1] Bioconductor  
#&gt;  Biostrings             2.54.0   2019-10-29 [1] Bioconductor  
#&gt;  biovizBase             1.34.1   2019-12-04 [1] Bioconductor  
#&gt;  bit                    1.1-15.2 2020-02-10 [1] CRAN (R 3.6.0)
#&gt;  bit64                  0.9-7    2017-05-08 [1] CRAN (R 3.6.0)
#&gt;  bitops                 1.0-6    2013-08-17 [1] CRAN (R 3.6.0)
#&gt;  blob                   1.2.1    2020-01-20 [1] CRAN (R 3.6.0)
#&gt;  BSgenome               1.54.0   2019-10-29 [1] Bioconductor  
#&gt;  checkmate              2.0.0    2020-02-06 [1] CRAN (R 3.6.0)
#&gt;  cli                    2.0.2    2020-02-28 [1] CRAN (R 3.6.0)
#&gt;  cluster                2.0.8    2019-04-05 [2] CRAN (R 3.6.0)
#&gt;  colorspace             1.4-1    2019-03-18 [1] CRAN (R 3.6.0)
#&gt;  crayon                 1.3.4    2017-09-16 [1] CRAN (R 3.6.0)
#&gt;  curl                   4.3      2019-12-02 [1] CRAN (R 3.6.0)
#&gt;  data.table             1.12.8   2019-12-09 [1] CRAN (R 3.6.0)
#&gt;  DBI                    1.1.0    2019-12-15 [1] CRAN (R 3.6.0)
#&gt;  dbplyr                 1.4.2    2019-06-17 [1] CRAN (R 3.6.0)
#&gt;  DelayedArray           0.12.2   2020-01-06 [1] Bioconductor  
#&gt;  dichromat              2.0-0    2013-01-24 [1] CRAN (R 3.6.0)
#&gt;  digest                 0.6.25   2020-02-23 [1] CRAN (R 3.6.0)
#&gt;  dplyr                  0.8.5    2020-03-07 [1] CRAN (R 3.6.0)
#&gt;  ellipsis               0.3.1    2020-05-15 [1] CRAN (R 3.6.0)
#&gt;  ensembldb              2.10.2   2019-11-20 [1] Bioconductor  
#&gt;  evaluate               0.14     2019-05-28 [1] CRAN (R 3.6.0)
#&gt;  fansi                  0.4.1    2020-01-08 [1] CRAN (R 3.6.0)
#&gt;  farver                 2.0.3    2020-01-16 [1] CRAN (R 3.6.0)
#&gt;  foreign                0.8-71   2018-07-20 [2] CRAN (R 3.6.0)
#&gt;  Formula                1.2-3    2018-05-03 [1] CRAN (R 3.6.0)
#&gt;  fs                     1.4.0    2020-03-31 [1] CRAN (R 3.6.0)
#&gt;  GenomeInfoDb           1.22.1   2020-03-27 [1] Bioconductor  
#&gt;  GenomeInfoDbData       1.2.2    2020-04-01 [1] Bioconductor  
#&gt;  GenomicAlignments      1.22.1   2019-11-12 [1] Bioconductor  
#&gt;  GenomicFeatures        1.38.2   2020-02-15 [1] Bioconductor  
#&gt;  GenomicRanges          1.38.0   2019-10-29 [1] Bioconductor  
#&gt;  GGally                 1.5.0    2020-03-25 [1] CRAN (R 3.6.0)
#&gt;  ggbio                * 1.34.0   2019-10-29 [1] Bioconductor  
#&gt;  ggplot2              * 3.3.2    2020-06-19 [1] CRAN (R 3.6.0)
#&gt;  glue                   1.4.1    2020-05-13 [1] CRAN (R 3.6.0)
#&gt;  graph                  1.64.0   2019-10-29 [1] Bioconductor  
#&gt;  gridExtra              2.3      2017-09-09 [1] CRAN (R 3.6.0)
#&gt;  gtable                 0.3.0    2019-03-25 [1] CRAN (R 3.6.0)
#&gt;  highr                  0.8      2019-03-20 [1] CRAN (R 3.6.0)
#&gt;  Hmisc                  4.4-0    2020-03-23 [1] CRAN (R 3.6.0)
#&gt;  hms                    0.5.3    2020-01-08 [1] CRAN (R 3.6.0)
#&gt;  htmlTable              1.13.3   2019-12-04 [1] CRAN (R 3.6.0)
#&gt;  htmltools              0.5.0    2020-06-16 [1] CRAN (R 3.6.0)
#&gt;  htmlwidgets            1.5.1    2019-10-08 [1] CRAN (R 3.6.0)
#&gt;  httr                   1.4.1    2019-08-05 [1] CRAN (R 3.6.0)
#&gt;  IRanges                2.20.2   2020-01-13 [1] Bioconductor  
#&gt;  jpeg                   0.1-8.1  2019-10-24 [1] CRAN (R 3.6.0)
#&gt;  knitr                  1.29     2020-06-23 [1] CRAN (R 3.6.0)
#&gt;  labeling               0.3      2014-08-23 [1] CRAN (R 3.6.0)
#&gt;  lattice                0.20-38  2018-11-04 [2] CRAN (R 3.6.0)
#&gt;  latticeExtra           0.6-29   2019-12-19 [1] CRAN (R 3.6.0)
#&gt;  lazyeval               0.2.2    2019-03-15 [1] CRAN (R 3.6.0)
#&gt;  lifecycle              0.2.0    2020-03-06 [1] CRAN (R 3.6.0)
#&gt;  magrittr               1.5      2014-11-22 [1] CRAN (R 3.6.0)
#&gt;  Matrix                 1.2-17   2019-03-22 [2] CRAN (R 3.6.0)
#&gt;  matrixStats            0.56.0   2020-03-13 [1] CRAN (R 3.6.0)
#&gt;  memoise                1.1.0    2017-04-21 [1] CRAN (R 3.6.0)
#&gt;  mime                   0.9      2020-02-04 [1] CRAN (R 3.6.0)
#&gt;  munsell                0.5.0    2018-06-12 [1] CRAN (R 3.6.0)
#&gt;  nnet                   7.3-12   2016-02-02 [2] CRAN (R 3.6.0)
#&gt;  openssl                1.4.1    2019-07-18 [1] CRAN (R 3.6.0)
#&gt;  OrganismDbi            1.28.0   2019-10-29 [1] Bioconductor  
#&gt;  patchwork            * 1.0.0    2019-12-01 [1] CRAN (R 3.6.0)
#&gt;  pillar                 1.4.3    2019-12-20 [1] CRAN (R 3.6.0)
#&gt;  pkgconfig              2.0.3    2019-09-22 [1] CRAN (R 3.6.0)
#&gt;  plyr                   1.8.6    2020-03-03 [1] CRAN (R 3.6.0)
#&gt;  png                    0.1-7    2013-12-03 [1] CRAN (R 3.6.0)
#&gt;  prettyunits            1.1.1    2020-01-24 [1] CRAN (R 3.6.0)
#&gt;  progress               1.2.2    2019-05-16 [1] CRAN (R 3.6.0)
#&gt;  ProtGenerics           1.18.0   2019-10-29 [1] Bioconductor  
#&gt;  purrr                  0.3.4    2020-04-17 [1] CRAN (R 3.6.0)
#&gt;  R6                     2.4.1    2019-11-12 [1] CRAN (R 3.6.0)
#&gt;  rappdirs               0.3.1    2016-03-28 [1] CRAN (R 3.6.0)
#&gt;  RBGL                   1.62.1   2019-10-30 [1] Bioconductor  
#&gt;  RColorBrewer           1.1-2    2014-12-07 [1] CRAN (R 3.6.0)
#&gt;  Rcpp                   1.0.4.6  2020-04-09 [1] CRAN (R 3.6.0)
#&gt;  RCurl                  1.98-1.1 2020-01-19 [1] CRAN (R 3.6.0)
#&gt;  reprex                 1.0.0    2021-01-27 [1] CRAN (R 3.6.0)
#&gt;  reshape                0.8.8    2018-10-23 [1] CRAN (R 3.6.0)
#&gt;  reshape2               1.4.4    2020-04-09 [1] CRAN (R 3.6.0)
#&gt;  rlang                  0.4.6    2020-05-02 [1] CRAN (R 3.6.0)
#&gt;  rmarkdown              2.1      2020-01-20 [1] CRAN (R 3.6.0)
#&gt;  rpart                  4.1-15   2019-04-12 [2] CRAN (R 3.6.0)
#&gt;  Rsamtools              2.2.3    2020-02-23 [1] Bioconductor  
#&gt;  RSQLite                2.2.0    2020-01-07 [1] CRAN (R 3.6.0)
#&gt;  rstudioapi             0.11     2020-02-07 [1] CRAN (R 3.6.0)
#&gt;  rtracklayer            1.46.0   2019-10-29 [1] Bioconductor  
#&gt;  S4Vectors              0.24.3   2020-01-18 [1] Bioconductor  
#&gt;  scales                 1.1.1    2020-05-11 [1] CRAN (R 3.6.0)
#&gt;  sessioninfo            1.1.1    2018-11-05 [1] CRAN (R 3.6.0)
#&gt;  stringi                1.4.6    2020-02-17 [1] CRAN (R 3.6.0)
#&gt;  stringr                1.4.0    2019-02-10 [1] CRAN (R 3.6.0)
#&gt;  styler                 1.3.2    2020-02-23 [1] CRAN (R 3.6.0)
#&gt;  SummarizedExperiment   1.16.1   2019-12-19 [1] Bioconductor  
#&gt;  survival               3.1-11   2020-03-07 [1] CRAN (R 3.6.0)
#&gt;  tibble                 3.0.0    2020-03-30 [1] CRAN (R 3.6.0)
#&gt;  tidyselect             1.0.0    2020-01-27 [1] CRAN (R 3.6.0)
#&gt;  VariantAnnotation      1.32.0   2019-10-29 [1] Bioconductor  
#&gt;  vctrs                  0.2.4    2020-03-10 [1] CRAN (R 3.6.0)
#&gt;  withr                  2.4.1    2021-01-26 [1] CRAN (R 3.6.0)
#&gt;  xfun                   0.15     2020-06-21 [1] CRAN (R 3.6.0)
#&gt;  XML                    3.99-0.3 2020-01-20 [1] CRAN (R 3.6.0)
#&gt;  xml2                   1.3.0    2020-04-01 [1] CRAN (R 3.6.0)
#&gt;  XVector                0.26.0   2019-10-29 [1] Bioconductor  
#&gt;  yaml                   2.2.1    2020-02-01 [1] CRAN (R 3.6.0)
#&gt;  zlibbioc               1.32.0   2019-10-29 [1] Bioconductor  
</code></pre>
</p>


CC BY-SA 4.0
2021-02-07T23:22:39.200Z
@Alex Does this solution work when aligning multiple genome tracks using ggbio as in my original example?  Either way, useful info for others. My original question was actually aiming to get feedback on how others make these types of plots rather than seeking a solution to a specific problem in my workflow, so if you have any thoughts on that I'd be interested
Reilstein
CC BY-SA 4.0
2021-02-08T08:37:35.330Z
@Reilstein this solution requires more work to align multiple genome tracks based on coordinates, so actually does not really answer your initial question. 
I was using Gviz before, but I like ggbio more due to the ease of use and how it integrates with ggplot2.
Alex
CC BY-SA 4.0
2021-02-05T11:49:16.253Z
2021-02-05T11:49:16.253Z
Alex
<p>I am curious how people make genome track plots such as what can be done with the Bioconductor package <code>ggbio</code>.</p>
<p>For example this plot was made w/ ggbio:
<a href="https://i.sstatic.net/E56jf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/E56jf.png" alt="enter image description here" /></a></p>
<p>I think ggbio is great for making fast plots, but it is kind of a pain to make publication quality figures because it is hard to manipulate the plots after they are constructed. I have noticed that ggbio constructed plots do not return a ggplot or gtable object. I can access the grobs from a ggbio tracks object, but they won't be aligned as they would be in the final plot. I like to make shared legends and include them in the plot, and without having a gtable or ggplot object it is hard to add the shared legends in, and I end up having to save them as a separate file which is tedious. FYI I mainly use ggbio for gene tracks + x-axis alignment.</p>
<p>Normally I would use ggplot2 to customize the plot extensively, but it doesn't work very well after plotting with ggbio.</p>
<p>How can I use ggbio for these types of plots? Is there a better tool instead?</p>
<p>EDIT:
I would get the legends for each individual plot and combine them before adding back to the main plot using something like this:</p>
<pre><code>leg1.grob = cowplot::get_legend(plot1)
leg2.grob = cowplot::get_legend(plot2)
sharedleg.grob = gridExtra::gtable_rbind(leg1,leg2)

mainplot.grob = ggplotGrob(main_plot)
mainplot.grob = gtable_add_cols(mainplot.grob, 
                                widths = sum(sharedleg.grob$widths))
mainplot.grob = gtable_add_grobs(mainplot.grob, 
                                 grobs = sharedleg.grob, 
                                 t=t,b=b,l=l,r=r)
cowplot::ggdraw(mainplot.grob)
</code></pre>
<p>I've used <a href="https://bioconductor.org/packages/release/bioc/html/Gviz.html" rel="nofollow noreferrer">gviz</a> before, but long ago. Do you know if you can extract the grid plot grobs of the gene track plots with Gviz?</p>

<r><visualization><ggplot2>
Plotting gene models - alternatives to ggbio
# Plotting gene models - alternatives to ggbio

(Asked by: username_0 on 2018-05-21)

I am curious how people make genome track plots such as what can be done with the Bioconductor package ggbio.
For example this plot was made w/ ggbio:

I think ggbio is great for making fast plots, but it is kind of a pain to make publication quality figures because it is hard to manipulate the plots after they are constructed. I have noticed that ggbio constructed plots do not return a ggplot or gtable object. I can access the grobs from a ggbio tracks object, but they won't be aligned as they would be in the final plot. I like to make shared legends and include them in the plot, and without having a gtable or ggplot object it is hard to add the shared legends in, and I end up having to save them as a separate file which is tedious. FYI I mainly use ggbio for gene tracks + x-axis alignment.
Normally I would use ggplot2 to customize the plot extensively, but it doesn't work very well after plotting with ggbio.
How can I use ggbio for these types of plots? Is there a better tool instead?
EDIT:
I would get the legends for each individual plot and combine them before adding back to the main plot using something like this:
leg1.grob = cowplot::get_legend(plot1)
leg2.grob = cowplot::get_legend(plot2)
sharedleg.grob = gridExtra::gtable_rbind(leg1,leg2)

mainplot.grob = ggplotGrob(main_plot)
mainplot.grob = gtable_add_cols(mainplot.grob, 
                                widths = sum(sharedleg.grob$widths))
mainplot.grob = gtable_add_grobs(mainplot.grob, 
                                 grobs = sharedleg.grob, 
                                 t=t,b=b,l=l,r=r)
cowplot::ggdraw(mainplot.grob)

I've used gviz before, but long ago. Do you know if you can extract the grid plot grobs of the gene track plots with Gviz?

**Tags:** r, visualization, ggplot2

---

## 1 answers

### Answer by username_1 on 2021-02-05. Score: 1

It seems like the ggbio object already contains the corresponding ggplot object.
You should be able to extract the ggplot from the ggbio_obj@ggplot slot and extract your gtables.
Small example:
library(ggbio)
library(ggplot2)
library(patchwork)

fl.bam <- system.file("extdata", "wg-brca1.sorted.bam", package = "biovizBase")
wh <- as(c("chr17:41239394-41319151:+"), "GRanges")
p_cov <- autoplot(fl.bam, which = wh)
#> reading in as Bamfile
#> Parsing raw coverage...
#> Read GAlignments from BamFile...
#> extracting information...


df <-  data.frame(x= sample(1:100,size = 100,replace = TRUE))
p_hist <- ggplot(df) + 
    geom_histogram(aes(x))


p_hist / p_cov
#> Error: Can't add `e2` to a ggplot object.
#> Backtrace:
#>     █
#>  1. └─patchwork:::`/.ggplot`(p_hist, p_cov)
#>  2.   └─GGally:::`+.gg`(e1, e2)
#>  3.     └─e1 %+% e2
#>  4.       └─ggplot2:::add_ggplot(e1, e2, e2name)
#>  5.         ├─ggplot2::ggplot_add(object, p, objectname)
#>  6.         └─ggplot2:::ggplot_add.default(object, p, objectname)

p_hist / p_cov@ggplot
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.


Created on 2021-02-05 by the reprex package (v1.0.0)
Session info

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.0 (2019-04-26)
#>  os       Red Hat Enterprise Linux    
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       Europe/Berlin               
#>  date     2021-02-05                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package              * version  date       lib source        
#>  acepack                1.4.1    2016-10-29 [1] CRAN (R 3.6.0)
#>  AnnotationDbi          1.48.0   2019-10-29 [1] Bioconductor  
#>  AnnotationFilter       1.10.0   2019-10-29 [1] Bioconductor  
#>  askpass                1.1      2019-01-13 [1] CRAN (R 3.6.0)
#>  assertthat             0.2.1    2019-03-21 [1] CRAN (R 3.6.0)
#>  backports              1.1.8    2020-06-17 [1] CRAN (R 3.6.0)
#>  base64enc              0.1-3    2015-07-28 [1] CRAN (R 3.6.0)
#>  Biobase                2.46.0   2019-10-29 [1] Bioconductor  
#>  BiocFileCache          1.10.2   2019-11-08 [1] Bioconductor  
#>  BiocGenerics         * 0.32.0   2019-10-29 [1] Bioconductor  
#>  BiocManager            1.30.10  2019-11-16 [1] CRAN (R 3.6.0)
#>  BiocParallel           1.20.1   2019-12-21 [1] Bioconductor  
#>  biomaRt                2.42.1   2020-03-26 [1] Bioconductor  
#>  Biostrings             2.54.0   2019-10-29 [1] Bioconductor  
#>  biovizBase             1.34.1   2019-12-04 [1] Bioconductor  
#>  bit                    1.1-15.2 2020-02-10 [1] CRAN (R 3.6.0)
#>  bit64                  0.9-7    2017-05-08 [1] CRAN (R 3.6.0)
#>  bitops                 1.0-6    2013-08-17 [1] CRAN (R 3.6.0)
#>  blob                   1.2.1    2020-01-20 [1] CRAN (R 3.6.0)
#>  BSgenome               1.54.0   2019-10-29 [1] Bioconductor  
#>  checkmate              2.0.0    2020-02-06 [1] CRAN (R 3.6.0)
#>  cli                    2.0.2    2020-02-28 [1] CRAN (R 3.6.0)
#>  cluster                2.0.8    2019-04-05 [2] CRAN (R 3.6.0)
#>  colorspace             1.4-1    2019-03-18 [1] CRAN (R 3.6.0)
#>  crayon                 1.3.4    2017-09-16 [1] CRAN (R 3.6.0)
#>  curl                   4.3      2019-12-02 [1] CRAN (R 3.6.0)
#>  data.table             1.12.8   2019-12-09 [1] CRAN (R 3.6.0)
#>  DBI                    1.1.0    2019-12-15 [1] CRAN (R 3.6.0)
#>  dbplyr                 1.4.2    2019-06-17 [1] CRAN (R 3.6.0)
#>  DelayedArray           0.12.2   2020-01-06 [1] Bioconductor  
#>  dichromat              2.0-0    2013-01-24 [1] CRAN (R 3.6.0)
#>  digest                 0.6.25   2020-02-23 [1] CRAN (R 3.6.0)
#>  dplyr                  0.8.5    2020-03-07 [1] CRAN (R 3.6.0)
#>  ellipsis               0.3.1    2020-05-15 [1] CRAN (R 3.6.0)
#>  ensembldb              2.10.2   2019-11-20 [1] Bioconductor  
#>  evaluate               0.14     2019-05-28 [1] CRAN (R 3.6.0)
#>  fansi                  0.4.1    2020-01-08 [1] CRAN (R 3.6.0)
#>  farver                 2.0.3    2020-01-16 [1] CRAN (R 3.6.0)
#>  foreign                0.8-71   2018-07-20 [2] CRAN (R 3.6.0)
#>  Formula                1.2-3    2018-05-03 [1] CRAN (R 3.6.0)
#>  fs                     1.4.0    2020-03-31 [1] CRAN (R 3.6.0)
#>  GenomeInfoDb           1.22.1   2020-03-27 [1] Bioconductor  
#>  GenomeInfoDbData       1.2.2    2020-04-01 [1] Bioconductor  
#>  GenomicAlignments      1.22.1   2019-11-12 [1] Bioconductor  
#>  GenomicFeatures        1.38.2   2020-02-15 [1] Bioconductor  
#>  GenomicRanges          1.38.0   2019-10-29 [1] Bioconductor  
#>  GGally                 1.5.0    2020-03-25 [1] CRAN (R 3.6.0)
#>  ggbio                * 1.34.0   2019-10-29 [1] Bioconductor  
#>  ggplot2              * 3.3.2    2020-06-19 [1] CRAN (R 3.6.0)
#>  glue                   1.4.1    2020-05-13 [1] CRAN (R 3.6.0)
#>  graph                  1.64.0   2019-10-29 [1] Bioconductor  
#>  gridExtra              2.3      2017-09-09 [1] CRAN (R 3.6.0)
#>  gtable                 0.3.0    2019-03-25 [1] CRAN (R 3.6.0)
#>  highr                  0.8      2019-03-20 [1] CRAN (R 3.6.0)
#>  Hmisc                  4.4-0    2020-03-23 [1] CRAN (R 3.6.0)
#>  hms                    0.5.3    2020-01-08 [1] CRAN (R 3.6.0)
#>  htmlTable              1.13.3   2019-12-04 [1] CRAN (R 3.6.0)
#>  htmltools              0.5.0    2020-06-16 [1] CRAN (R 3.6.0)
#>  htmlwidgets            1.5.1    2019-10-08 [1] CRAN (R 3.6.0)
#>  httr                   1.4.1    2019-08-05 [1] CRAN (R 3.6.0)
#>  IRanges                2.20.2   2020-01-13 [1] Bioconductor  
#>  jpeg                   0.1-8.1  2019-10-24 [1] CRAN (R 3.6.0)
#>  knitr                  1.29     2020-06-23 [1] CRAN (R 3.6.0)
#>  labeling               0.3      2014-08-23 [1] CRAN (R 3.6.0)
#>  lattice                0.20-38  2018-11-04 [2] CRAN (R 3.6.0)
#>  latticeExtra           0.6-29   2019-12-19 [1] CRAN (R 3.6.0)
#>  lazyeval               0.2.2    2019-03-15 [1] CRAN (R 3.6.0)
#>  lifecycle              0.2.0    2020-03-06 [1] CRAN (R 3.6.0)
#>  magrittr               1.5      2014-11-22 [1] CRAN (R 3.6.0)
#>  Matrix                 1.2-17   2019-03-22 [2] CRAN (R 3.6.0)
#>  matrixStats            0.56.0   2020-03-13 [1] CRAN (R 3.6.0)
#>  memoise                1.1.0    2017-04-21 [1] CRAN (R 3.6.0)
#>  mime                   0.9      2020-02-04 [1] CRAN (R 3.6.0)
#>  munsell                0.5.0    2018-06-12 [1] CRAN (R 3.6.0)
#>  nnet                   7.3-12   2016-02-02 [2] CRAN (R 3.6.0)
#>  openssl                1.4.1    2019-07-18 [1] CRAN (R 3.6.0)
#>  OrganismDbi            1.28.0   2019-10-29 [1] Bioconductor  
#>  patchwork            * 1.0.0    2019-12-01 [1] CRAN (R 3.6.0)
#>  pillar                 1.4.3    2019-12-20 [1] CRAN (R 3.6.0)
#>  pkgconfig              2.0.3    2019-09-22 [1] CRAN (R 3.6.0)
#>  plyr                   1.8.6    2020-03-03 [1] CRAN (R 3.6.0)
#>  png                    0.1-7    2013-12-03 [1] CRAN (R 3.6.0)
#>  prettyunits            1.1.1    2020-01-24 [1] CRAN (R 3.6.0)
#>  progress               1.2.2    2019-05-16 [1] CRAN (R 3.6.0)
#>  ProtGenerics           1.18.0   2019-10-29 [1] Bioconductor  
#>  purrr                  0.3.4    2020-04-17 [1] CRAN (R 3.6.0)
#>  R6                     2.4.1    2019-11-12 [1] CRAN (R 3.6.0)
#>  rappdirs               0.3.1    2016-03-28 [1] CRAN (R 3.6.0)
#>  RBGL                   1.62.1   2019-10-30 [1] Bioconductor  
#>  RColorBrewer           1.1-2    2014-12-07 [1] CRAN (R 3.6.0)
#>  Rcpp                   1.0.4.6  2020-04-09 [1] CRAN (R 3.6.0)
#>  RCurl                  1.98-1.1 2020-01-19 [1] CRAN (R 3.6.0)
#>  reprex                 1.0.0    2021-01-27 [1] CRAN (R 3.6.0)
#>  reshape                0.8.8    2018-10-23 [1] CRAN (R 3.6.0)
#>  reshape2               1.4.4    2020-04-09 [1] CRAN (R 3.6.0)
#>  rlang                  0.4.6    2020-05-02 [1] CRAN (R 3.6.0)
#>  rmarkdown              2.1      2020-01-20 [1] CRAN (R 3.6.0)
#>  rpart                  4.1-15   2019-04-12 [2] CRAN (R 3.6.0)
#>  Rsamtools              2.2.3    2020-02-23 [1] Bioconductor  
#>  RSQLite                2.2.0    2020-01-07 [1] CRAN (R 3.6.0)
#>  rstudioapi             0.11     2020-02-07 [1] CRAN (R 3.6.0)
#>  rtracklayer            1.46.0   2019-10-29 [1] Bioconductor  
#>  S4Vectors              0.24.3   2020-01-18 [1] Bioconductor  
#>  scales                 1.1.1    2020-05-11 [1] CRAN (R 3.6.0)
#>  sessioninfo            1.1.1    2018-11-05 [1] CRAN (R 3.6.0)
#>  stringi                1.4.6    2020-02-17 [1] CRAN (R 3.6.0)
#>  stringr                1.4.0    2019-02-10 [1] CRAN (R 3.6.0)
#>  styler                 1.3.2    2020-02-23 [1] CRAN (R 3.6.0)
#>  SummarizedExperiment   1.16.1   2019-12-19 [1] Bioconductor  
#>  survival               3.1-11   2020-03-07 [1] CRAN (R 3.6.0)
#>  tibble                 3.0.0    2020-03-30 [1] CRAN (R 3.6.0)
#>  tidyselect             1.0.0    2020-01-27 [1] CRAN (R 3.6.0)
#>  VariantAnnotation      1.32.0   2019-10-29 [1] Bioconductor  
#>  vctrs                  0.2.4    2020-03-10 [1] CRAN (R 3.6.0)
#>  withr                  2.4.1    2021-01-26 [1] CRAN (R 3.6.0)
#>  xfun                   0.15     2020-06-21 [1] CRAN (R 3.6.0)
#>  XML                    3.99-0.3 2020-01-20 [1] CRAN (R 3.6.0)
#>  xml2                   1.3.0    2020-04-01 [1] CRAN (R 3.6.0)
#>  XVector                0.26.0   2019-10-29 [1] Bioconductor  
#>  yaml                   2.2.1    2020-02-01 [1] CRAN (R 3.6.0)
#>  zlibbioc               1.32.0   2019-10-29 [1] Bioconductor

> **Comments:**
> **username_0**: @Alex Does this solution work when aligning multiple genome tracks using ggbio as in my original example?  Either way, useful info for others. My original question was actually aiming to get feedback on how others make these types of plots rather than seeking a solution to a specific problem in my workflow, so if you have any thoughts on that I'd be interested  
> **username_1**: @Reilstein this solution requires more work to align multiple genome tracks based on coordinates, so actually does not really answer your initial question.  I was using Gviz before, but I like ggbio more due to the ease of use and how it integrates with ggplot2.  

---

