Learn R Programming

glow (version 0.13.0)

circular_palette: circular_palette

Description

A helper function for circularizing color palettes.

Usage

circular_palette(n, pal_function=rainbow, invert=FALSE, ...)

Value

A circular color palette

Arguments

n

Number of colors to output (must be divisible by 2)

pal_function

The base palette to circularize

invert

Whether to invert the palette See details.

...

Arguments passed to `pal_function`

Details

This function is useful when the color represents radial data. E.g. position on a sphere or circle. The `invert` parameter reverses the order of circularization. E.g. if your circular palette would be red to blue to red, `invert` changes this blue to red to blue.

Examples

Run this code
colors <- circular_palette(n=1000, pal_function=rainbow)
t <- seq(0,2*pi, length.out=1000)
plot(sin(t), cos(t), col = colors, pch = 19)

Run the code above in your browser using DataLab