Learn R Programming

corpora (version 0.6)

corpora.palette: Colour palettes for linguistic visualization (corpora)

Description

Several useful colour palettes for plots and other visualizations.

The function alpha.col can be used to turn colours (partially) translucent for used in crowded scatterplots.

Usage

corpora.palette(name=c("seaborn", "muted", "bright", "simple"), 
                n=NULL, alpha=1)

alpha.col(col, alpha)

Value

A character vector with colour names or hexadecimal RGB specifications.

Arguments

name

name of the desired colour palette (see Details below)

n

optional: number of colours to return. The palette will be shortened or recycled as necessary.

col

a vector of R colour specifications (as accepted by col2rgb)

alpha

alpha value between 0 and 1; values below 1 make the colours translucent

Author

Stephanie Evert (https://purl.org/stephanie.evert)

Details

Every colour palette starts with the colours black, red, green and blue in this order.

seaborn, muted and bright are 7-colour palettes inspired by the seaborn data visualization library, but add a shade of dark grey as first colour.

simple is a 10-colour palette based on R's default palette.

See Also

rgb for R colour specification formats, palette for setting the default colour palette

Examples

Run this code
par.save <- par(mfrow=c(2, 2))
for (name in qw("seaborn muted bright simple")) {
  barplot(rep(1, 10), col=corpora.palette(name, 10), main=name)
}
par(par.save)

Run the code above in your browser using DataLab