rand_color: Generate random colors

Description Usage Arguments Details Value Author(s) Examples

Description

Generate random colors

Usage

1
rand_color(n, hue = NULL, luminosity = "random", transparency = 0)

Arguments

n

number of colors

hue

the hue of the generated color. You can use following default color name: red, orange, yellow, green, blue, purple, pink and monochrome. If the value is a hexidecimal color string such as #00FFFF, the function will extract its hue value and use that to generate colors.

luminosity

controls the luminosity of the generated color. The value should be a string containing bright, light, dark and random.

transparency

transparency, numeric value between 0 and 1.

Details

The code is adapted from randomColor.js (https://github.com/davidmerfield/randomColor ).

Value

a vector of colors

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
plot(NULL, xlim = c(1, 10), ylim = c(1, 8), axes = FALSE, ann = FALSE)
points(1:10, rep(1, 10), pch = 16, cex = 5, 
    col = rand_color(10, luminosity = "random"))
points(1:10, rep(2, 10), pch = 16, cex = 5, 
    col = rand_color(10, luminosity = "bright"))
points(1:10, rep(3, 10), pch = 16, cex = 5, 
    col = rand_color(10, luminosity = "light"))
points(1:10, rep(4, 10), pch = 16, cex = 5, 
    col = rand_color(10, luminosity = "dark"))
points(1:10, rep(5, 10), pch = 16, cex = 5, 
    col = rand_color(10, hue = "red", luminosity = "bright"))
points(1:10, rep(6, 10), pch = 16, cex = 5, 
    col = rand_color(10, hue = "green", luminosity = "bright"))
points(1:10, rep(7, 10), pch = 16, cex = 5, 
    col = rand_color(10, hue = "blue", luminosity = "bright"))
points(1:10, rep(8, 10), pch = 16, cex = 5, 
    col = rand_color(10, hue = "monochrome", luminosity = "bright"))

1156054203/circlize- documentation built on May 22, 2019, 2 p.m.