rand_color | R Documentation |
Generate random colors
rand_color(n, hue = NULL, luminosity = "random", transparency = 0, friendly = FALSE)
n |
Number of colors |
hue |
The hue of the generated color. You can use following default color name: |
luminosity |
it controls the luminosity of the generated color. The value should be a string containing |
transparency |
Transparency, numeric value between 0 and 1. |
friendly |
If it is true, light random colors will not be generated. |
The code is adapted from randomColor.js (https://github.com/davidmerfield/randomColor ).
A vector of colors.
Zuguang Gu <z.gu@dkfz.de>
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)) 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.