Description Usage Arguments Value Author(s) References Examples
ggcolors
- Make a palette with ggplot2's default color scheme.
random_ggcolors
- Make a random n length palette with ggplot2's
default color scheme.
1 2 3 | ggcolors(n)
random_ggcolors(n)
|
n |
An integer specifying the number of colors. |
Returns a vector of n
hex colors.
John Colby
http://stackoverflow.com/a/8197703/1000343
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | scales:::show_col(ggcolors(n=9))
n <- 10
ggcolors(n)
plot(
1:n,
pch=16,
cex=2,
col= ggcolors(n)
)
barplot(
stats::setNames(5:14, LETTERS[5:14]),
col = ggcolors(n),
border = ggcolors(n)
)
boxplot(
x ~ y,
data = data.frame(x = rnorm(1000),
y = sample(LETTERS[5:14], 1000, TRUE)),
border = ggcolors(n),
lwd=2
)
pie(
stats::setNames(5:14, LETTERS[5:14]),
col = ggcolors(n),
border = ggcolors(n)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.