safeBrew: allows RColorBrew to handle n values less than 3 and greater...

Description Usage Arguments Value Examples

View source: R/misc_helpers.R

Description

allows RColorBrew to handle n values less than 3 and greater than 8 without warnings and return expected number of colors.

Usage

1
safeBrew(n, pal = "Dark2")

Arguments

n

integer value of number of colors to make palette for

pal

palette recognized by RColorBrewer

Value

a character vector of hex coded colors o flength n from the color brewer palette pal

Examples

1
2
3
4
plot(1:2, rep(0, 2),  col = safeBrew(2, "dark2"), pch = 16, cex = 6)
plot(1:12, rep(0, 12),  col = safeBrew(12, "set1"), pch = 16, cex = 6)
plot(1:12, rep(0, 12),  col = safeBrew(12, "set2"), pch = 16, cex = 6)
plot(1:12, rep(0, 12),  col = safeBrew(12, "set3"), pch = 16, cex = 6)

jrboyd/seqsetvis documentation built on Dec. 15, 2018, 1:26 a.m.