plotflow (version 0.2.1)

ggcolors: ggplot2's Default Color Scheme

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

ggcolors(n)

random_ggcolors(n)

Arguments

n

An integer specifying the number of colors.

Value

Returns a vector of n hex colors.

References

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

Examples

Run this code
# NOT RUN {
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)
)
# }

Run the code above in your browser using DataLab