% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data-for-plot.R
\name{data.for.plot}
\alias{data.for.plot}
\title{Retrieve data for plotting}
\usage{
data.for.plot(
  object,
  label,
  label.type = c("search", "meta", "group", "sig", "gene", "counts", "pseudotime",
    "nmf", "pca", "diff.data"),
  cells.use = NULL,
  as.color = F,
  as.single.color = F,
  as.discrete.list = F,
  continuous.colors = NULL,
  continuous.color.limits = NULL,
  colors.use = NULL
)
}
\arguments{
\item{object}{An URD object}

\item{label}{(Character) The label of the data to search for}

\item{label.type}{(Character) Where to look for the data. Default is "search" which looks in order: "meta", "group", "sig", "gene", "counts", "pseudotime", "pca", "diff.data"}

\item{cells.use}{(Character vector) Which cells to return information for (default is NULL, which returns all cells)}

\item{as.color}{(Logical) Return hex color values instead of the raw data}

\item{as.single.color}{(Logical) Return on a scale from 0-1 as a "single color" to feed into \code{rgb()} for more complex color generation.}

\item{as.discrete.list}{(Logical) If TRUE, returns a list (see below).}

\item{continuous.colors}{(Character vector) Colors to use to produce a continuous color scale (used if data is continuous) and \code{as.color=T}.}

\item{continuous.color.limits}{(Numeric vector, length 2) Limits to use for scaling continuous color data. Data outside the range is squished into range. If \code{NULL}, uses the range of the data.}

\item{colors.use}{(Character vector) Colors to use for discrete data (default is NULL, which will use palette)}

\item{palette}{(Function) A palette (see \code{\link[grDevices]{Palettes}}) to use to generate colors for discrete data}
}
\value{
The value returned depends on the flags set. A vector is returned if \code{as.discrete.list=FALSE} or a list is returned if \code{as.discrete.list=TRUE} (see below). The data is returned directly if \code{as.color=F} and \code{as.single.color=F}, or it is returned as color values to plot directly if either are \code{TRUE}.
}
\description{
This retrieves data to annotate points on various plots and returns either
the data, or the data transformed into colors for plotting. This function is
called by most of URD's plotting routines.
}
\details{
By default, it searches for a label in the following order:
metadata (\code{"meta"}), group IDs (\code{"group"}), gene signatures (\code{"sig"}), 
gene expression (\code{"gene"}), unnormalized gene expression counts (\code{"counts"}),
pseudotime (\code{"pseudotime"}), NMF modules (\code{"nmf"}), principal components (\code{"pca"}), 
simulated diffusion results (\code{"diff.data"}).
However, data can be requested from a particular source by setting \code{label.type}. 
This can be used to get log-transformed but unnormalized expression data from
\code{count.data} by setting \code{label.type="counts"}.
}
\section{Discrete List Elements (if \code{as.discrete.list=T})}{

\describe{
  \item{$discrete}{(Logical) Is the data discrete or continuous?}
  \item{$data}{(Numeric or Character Vector) Either the data itself, or colors if \code{as.color=T} or \code{as.single.color=T}.}
  \item{$legend}{(Named Character Vector) Colors used, named by the data, returned if \code{as.color=T} and data is discrete}
  \item{$range}{(Numeric Vector) If data is continuous, the range of the data, otherwise NULL.}
}
}

