gradient: Get color gradients

View source: R/color_functions.R

gradientR Documentation

Get color gradients

Description

Get color gradients

Usage

gradient(colors, breaks = NULL, type = c("ggplot2", "colorRamp2"), name = NULL)

Arguments

colors

vector of colors

breaks

vector of breaks (required for 'colorRamp2')

type

generate gradient as ggplot2, colorRamp2 or none

name

use a pre-defined gradient

Examples

gradient(colors = c("-3 "= "blue", "0" = "white", "3" = "orangered"))
gradient(name = "bluered3", type = "colorramp2")
ggplot(iris, aes(Sepal.Length, Petal.Length, color = Sepal.Width)) + geom_point() + gradient(c("red", "green", "blue"), breaks = c(0,1,5))
ggplot(iris, aes(Sepal.Length, Petal.Length, color = Sepal.Width)) + geom_point() + gradient(c("red", "green", "blue"))
ComplexHeatmap::Heatmap(iris[,-5], col = gradient(name = "blueyellow3", type = "colorramp2", breaks = c(0,4,8)))

AlexanderKirchmair/datamisc documentation built on June 13, 2025, 5:26 a.m.