Stacks tracks vertically with patchwork, giving every track the same genomic
windows so their x-axes line up. Each track gets the same coord_loci() or
coord_genome(), window labels are kept on the top track only, and the x-axis
labels on the bottom track only. Tracks with another coord, such as the ideogram
from plot_ideogram(), are stacked as they are.
Arguments
- ...
Tracks to stack, top to bottom, as ggplots or a single list of ggplots. Tracks need no coord of their own.
- windows
Windows to show on every track, as for
coord_loci(), or"genome"forcoord_genome(). Default: the windows of the first track that has acoord_loci()orcoord_locus().- flank
Number of bp to extend both ends of each window, default: 0
- widths
How the axis is shared between windows:
"proportional"(default) to each window's length in bp, or"equal"so small windows stay readable next to large ones, each then at its own scale.- gap
Space between windows as a fraction of the total axis, default: 0.02
- dividers
Draw dashed lines between windows, default: TRUE
- window_labels
Labels of the windows on the top axis, as one of:
NULL(default): labeled with more than one window, by the names ofwindowsor else the chromosome.A character vector with one label per window.
TRUEorFALSEto show or hide the default labels. In a stack, keep the labels on the top track only.
- heights
Relative heights of the tracks, default: equal
- upper_x_axis
Bottom x-axis style of the tracks above the bottom track:
"ticks"(default),"blank", or"keep"to leave each track's own theme.- guides
Passed to
patchwork::wrap_plots(), default:"collect"to gather legends on the right.- highlight
Regions to highlight across the stack, as for
highlight_stack(). Default: none.- highlight_args
List of other arguments passed to
highlight_stack(), e.g.list(fill = c("#9BD08A", "#DC766F"), legend_title = "Windows").
Value
A patchwork, or with highlight, a highlighted stack from
highlight_stack()
Examples
if (FALSE) { # \dontrun{
windows <- c(MYC = "chr8:126500001-129500000", IGH = "chr14:105550001-106100000")
stack_tracks(
ggplot2::ggplot(junctions) + geom_junction(ggplot2::aes(colour = type)) + theme_genomic(),
ggplot2::ggplot(cn) + geom_copy_number(cn_cap = 8) + theme_genomic(),
ggplot2::ggplot() + geom_gene_track(genes_of_interest = c("MYC", "IGHM")) +
theme_genomic(y_axis = "blank"),
windows = windows, heights = c(1, 1, 0.5))
} # }
