circular_palette: circular_palette

View source: R/glow_functions.r

circular_paletteR Documentation

circular_palette

Description

A helper function for circularizing color palettes.

Usage

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

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.

Value

A circular color palette

Examples

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)

glow documentation built on April 6, 2023, 1:08 a.m.

Related to circular_palette in glow...