ExtendPalette: Extends a base-palette of the package RColorBrewer to n...

View source: R/palette.R

ExtendPaletteR Documentation

Extends a base-palette of the package RColorBrewer to n colors.

Description

The colors in the returned palette are always in the same order

Usage

ExtendPalette(n = NULL, base = "Set1")

Arguments

n

The number of desired colors in the palette

base

The name of the palette of the package RColorBrewer from which the extended palette is built. Default value is 'Set1'.

Value

A vector composed of n color code.

Author(s)

Samuel Wieczorek

Examples

ExtendPalette(12)
nPalette <- 10
par(mfrow = c(nPalette, 1))
par(mar = c(0.5, 4.5, 0.5, 0.5))
for (i in seq_len(nPalette)) {
    pal <- ExtendPalette(n = i, base = "Dark2")
    barplot(seq_len(length(pal)), col = pal)
    print(pal)
}


samWieczorek/Dapar2 documentation built on Oct. 12, 2023, 9:54 a.m.