Learn R Programming

miscset (version 1.0.0)

gghcl: HTML Colours Like ggplot2

Description

Calculate HTML colour code from a palette like ggplot2 uses.

Usage

gghcl(n, sub = 1:n, h = c(0, 360) + 15, c = 100, l = 65, ...)

Arguments

n
Numeric value to determine size of palette.
sub
Numeric vector with values within range from 1 to n to subset palette.
h
Hue of the colour. Within range of a circle's degrees.
c
Chroma of the colour.
l
Luminance of the colour. Within range from 1 to 100.
...
Further arguments passed to function hcl.

Value

Returns a character vector containing HTML colour code of the standard ggplot colour palette.

Details

See ?hcl for explanation of h, c and l.

See Also

hcl

Examples

Run this code
#

# Plot some palettes:
par(mfrow = c(3,1), mai = c(.1,.1,1,.1))
p <- matrix(1:10, 10)
image(p, col = gghcl(5), axes = FALSE, main ="gghcl(5)")
image(p, col = gghcl(10), axes = FALSE, main = "gghcl(10)")
image(p, col = gghcl(10, 1:5), axes = FALSE, main ="gghcl(10, 1:5)")
# dev.off() # to reset \code{par}

#

Run the code above in your browser using DataLab