colorby | R Documentation |
colorby
should be used to create a set of parameters
that specify color scaling for the functions plotPairs
,
plotPairsArches
, and plotRanges
.
colorby(column, palette = NULL, range = NULL, scalePerRegion = FALSE)
column |
String specifying name of data column to scale colors by. |
palette |
(optional) A function describing the color palette to use for color scaling. |
range |
(optional) A numeric vector specifying the range of values to apply a color scale to. |
scalePerRegion |
A logical value indicating whether to adjust
NULL range of numerical 'colorby' values to subset of data in a plotted
genomic region. Default value is |
Returns a "colorby
" object.
## Load paired ranges data in BEDPE format
library(plotgardenerData)
data("IMR90_DNAloops_pairs")
## Add a length column
IMR90_DNAloops_pairs$length <-
(IMR90_DNAloops_pairs$start2 - IMR90_DNAloops_pairs$start1) / 1000
## Plot pairs with colorby object set for `length` column
bedpePlot <- plotPairs(
data = IMR90_DNAloops_pairs,
chrom = "chr21",
chromstart = 27900000, chromend = 30700000,
assembly = "hg19",
fill = colorby("length", palette =
colorRampPalette(c("dodgerblue2", "firebrick2"))),
lwd = 2, spaceHeight = .7,
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.