numberToColorVec: Maps numeric vector to color palette

Description Usage Arguments Examples

View source: R/plotHelp.R

Description

Modified from Sushi::maptocolors

Usage

1

Arguments

numberVec

Numeric vector

palette

color palette to which to be mapped. Any valid palette in "BuenColors" should work.

range

The c(min, max) numeric values to make the color at the extremes.

Examples

1
2
3
4
i <- rnorm(1000)
df <- data.frame(x = i, y = 0, color = numberToColorVec(i^2, "brewer_heat"))
ggplot(shuf(df), aes(x=x, y=y, colour= color)) + geom_point() +
 scale_color_manual(values = levels(df$color))

caleblareau/BuenColors documentation built on March 7, 2020, 3:34 p.m.