colourScheme: colourScheme

View source: R/A001_colourScheme.R

colourSchemeR Documentation

colourScheme

Description

Creates a single function that can create colour schemes using many different packages with the option of interpolation.

Usage

colourScheme(
  numberOfColours = 10,
  scheme = "BW",
  colours = NULL,
  bias = 1,
  space = c("rgb", "Lab"),
  alpha = FALSE,
  interpolate = c("linear", "spline"),
  reverse = FALSE,
  discrete = TRUE,
  randomise = FALSE
)

Arguments

numberOfColours

The number of colours returned. Defaults to 10.

scheme

The palette or function to use. Used when colours is NULL. Defaults to "BW" for black and white. See details for more information.

colours

A starting set of colours that will be interpolated.

bias

used by colorRampPalette

space

used by colorRampPalette

alpha

used by colorRampPalette

interpolate

used by colorRampPalette

reverse

Reverses the final colour order. Defaults to FALSE

discrete

Defaults to TRUE

randomise

logical. If TRUE randomises the order of the answer. Defaults to FALSE

Details

The possible values of scheme are;

  • "BW" and "BWrev" for greyscale

  • "rainbow" and "rainbowrev" which uses rainbow()

  • "heat" and "heatrev" which uses heat.colors()

  • "terrain" and "terrainrev" which uses terrain.colors()

  • "topo" and "toporev" which uses topo.colors()

  • "cm" and "cmrev" which uses cm.colors()

  • "BrBG","PiYG","PRGn","PuOr","RdBu","RdGy","RdYlBu", "RdYlGn","Spectral","Accent","Dark2","Paired","Pastel1","Pastel2","Set1", "Set2","Set3","Blues","BuGn","BuPu","GnBu","Greens","Greys","Oranges", "OrRd","PuBu","PuBuGn","PuRd","Purples","RdPu","Reds","YlGn","YlGnBu", "YlOrBr" and "YlOrRd" from the RColorBrewer package

  • "plasma", "plasmarev", "viridis", "viridisrev", "magma", "magmarev", "inferno" and "infernorev" from the viridis package.

*"BottleRocket1","BottleRocket2","Rushmore1","Rushmore", "Royal1","Royal2","Zissou1","Darjeeling1", "Darjeeling2","Chevalier1","FantasticFox1","Moonrise1", "Moonrise2","Moonrise3","Cavalcanti1","GrandBudapest1", "GrandBudapest2","IsleofDogs1" and "IsleofDogs2" from the wesanderson package.

The above terms that end in rev overrides the reverse parameter to force reversing the colour scheme.

Value

Returns a vector of colours of the given length.

Examples

colourScheme()
colourScheme(25,"rainbow")

R-graphic-design/RGD documentation built on Jan. 2, 2023, 10:30 p.m.