colorby {plotgardener} | R Documentation

## Handle plotgardener color scaling parameters

### Description

`colorby` should be used to create a set of parameters that specify color scaling for the functions `plotPairs`, `plotPairsArches`, and `plotRanges`.

### Usage

    colorby(column, palette = NULL, range = NULL, scalePerRegion = FALSE)

### Arguments

`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 regoin. Default value is `scalePerRegion = FALSE`.

### Value

Returns a "`colorby`" object.

### Examples

    ## 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,
    )

[Package plotgardener version 1.0.17 Index]