brewPalette: Gets n colors from Brewer palette.

View source: R/plots.R

brewPaletteR Documentation

Gets n colors from Brewer palette.

Description

creates colors palette from the RColorBrewer package. By default, it uses palette name="Paired".

Usage

brewPalette(n, alpha = 1)

Arguments

n

<integer> Number of different colors in the palette, minimum 3, maximum depending on palette.

alpha

<numeric> Value from [0,1] to tune color opacity. By default, 1 gives maximum opacity.

Author(s)

Miquel Anglada Girotto

Examples

n = 2
plot(1:8, col = brewPalette(n), cex=5, pch=16)
n = 12
plot(1:n, col = brewPalette(n), cex=5, pch=16)
n = 8; alpha = 0.75
plot(1:100,sample(1:100), col=brewPalette(n,alpha), cex=5, pch=16)
n = 'this is not numeric'
plot(1:8, col = brewPalette(n), cex=5, pch=16) # should result in warning
n = -1
plot(1:8, col = brewPalette(n), cex=5, pch=16) # should result in warning

uzh/ezRun documentation built on March 5, 2025, 3:41 p.m.