ggcolors: ggplot2's Default Color Scheme

Description Usage Arguments Value Author(s) References Examples

Description

ggcolors - Make a palette with ggplot2's default color scheme.

random_ggcolors - Make a random n length palette with ggplot2's default color scheme.

Usage

1
2
3

Arguments

n

An integer specifying the number of colors.

Value

Returns a vector of n hex colors.

Author(s)

John Colby

References

http://stackoverflow.com/a/8197703/1000343

Examples

 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)
)

trinker/plotflow documentation built on May 31, 2019, 9:42 p.m.