Last data update: 2014.03.03

R: Various color palettes
colorsR Documentation

Various color palettes

Description

Create vectors of n contiguous colors.

Usage

cwm.colors(n, alpha = 1, s = 0.9, v = 0.9)
rwb.colors(n, alpha = 1, s = 0.9, v = 0.9)
ryg.colors(n, alpha = 1, s = 0.9, v = 0.9)

Arguments

n

the number of colors (>= 1) to be in the palette.

alpha

the alpha transparency, a number in [0, 1], see argument alpha in hsv.

s

the 'saturation' to be used to complete the HSV color descriptions.

v

the 'value' to use for the HSV color descriptions.

Details

cwm.colors(s = 0.5, v = 1) gives very similar colors to cm.colors().

ryg.colors() is similar to rainbow(start = 0, end = 2/6).

Value

A character vector, cv of color names. This can be used for user-defined color palette, using palette(cv), or a col = cv specification in a graphic function or in par.

Author(s)

Philippe Grosjean <phgrosjean@sciviews.org>

See Also

cm.colors, colorRampPalette

Examples

## Draw color wheels with various palettes
opar <- par(mfrow = c(2, 2))
pie(rep(1, 11), col = cwm.colors(11), main = "Cyan - white - magenta")
pie(rep(1, 11), col = rwb.colors(11), main = "Red - white - blue")
pie(rep(1, 11), col = ryg.colors(11), main = "Red - yellow - green (1)")
pie(rep(1, 11), col = ryg.colors(11, s = 0.5, v = 1), main = "Red - yellow - green (2)")
par(opar)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(SciViews)
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SciViews/colors.Rd_%03d_medium.png", width=480, height=480)
> ### Name: colors
> ### Title: Various color palettes
> ### Aliases: cwm.colors rwb.colors ryg.colors
> ### Keywords: color
> 
> ### ** Examples
> 
> ## Draw color wheels with various palettes
> opar <- par(mfrow = c(2, 2))
> pie(rep(1, 11), col = cwm.colors(11), main = "Cyan - white - magenta")
> pie(rep(1, 11), col = rwb.colors(11), main = "Red - white - blue")
> pie(rep(1, 11), col = ryg.colors(11), main = "Red - yellow - green (1)")
> pie(rep(1, 11), col = ryg.colors(11, s = 0.5, v = 1), main = "Red - yellow - green (2)")
> par(opar)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>