File: gradient.Rd

package info (click to toggle)
r-cran-formattable 0.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 420 kB
  • sloc: javascript: 15; sh: 12; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/style.R
\name{gradient}
\alias{gradient}
\title{Create a matrix from vector to represent colors in gradient}
\usage{
gradient(x, min.color, max.color, alpha = NULL, use.names = TRUE, na.rm = TRUE)
}
\arguments{
\item{x}{a numeric vector.}

\item{min.color}{color of minimum value.}

\item{max.color}{color of maximum value.}

\item{alpha}{logical of whether to include alpha channel. \code{NULL}
to let the function decide by input.}

\item{use.names}{logical of whether to preserve names of input vector.}

\item{na.rm}{logical indicating whether to ignore missing values as \code{x}
is normalized. (defult is \code{TRUE})}
}
\value{
a matrix with rgba columns in which each row corresponds to the rgba
value (0-255) of each element in input vector \code{x}. Use \code{csscolor}
to convert the matrix to css color strings compatible with web browsers.
}
\description{
Create a matrix from vector to represent colors in gradient
}
\examples{
gradient(c(1,2,3,4,5), "white", "red")
gradient(c(5,4,3,2,1), "white", "red")
gradient(c(1,3,2,4,5), "white", "red")
gradient(c(1,3,2,4,5), rgb(0,0,0,0.5), rgb(0,0,0,1), alpha = TRUE)
}
\seealso{
\code{\link{csscolor}}
}