% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/colorby.R
\name{colorby}
\alias{colorby}
\title{Handle plotgardener color scaling parameters}
\usage{
colorby(column, palette = NULL, range = NULL, scalePerRegion = FALSE)
}
\arguments{
\item{column}{String specifying name of data column to scale colors by.}

\item{palette}{(optional) A function describing the color palette to use for
color scaling.}

\item{range}{(optional) A numeric vector specifying the range of values to
apply a color scale to.}

\item{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 \code{scalePerRegion = FALSE}.}
}
\value{
Returns a "\code{colorby}" object.
}
\description{
\code{colorby} should be used to create a set of parameters
that specify color scaling for the functions \code{plotPairs},
\code{plotPairsArches}, and \code{plotRanges}.
}
\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,
)
}
