smooth_pal: Smooth a colour palette by interpolation.

Description Usage Arguments Details Value Author(s) Examples

View source: R/smooth_pal.r

Description

Takes a sequence of hex code colour codes and smooths the colour palette to a specified extended length.

Usage

1
  smooth_pal(pal, n = 10)

Arguments

pal

A character vector of hex code colours.

n

The number of colours to interpolate between colours. A larger value creates a smoother palette.

Details

You might want to consider using colour palettes from the package RColorBrewer.

Value

A character vector containing the smoothed colour palette.

Author(s)

Sean Anderson

Examples

1
2
3
4
5
6
7
8
require(RColorBrewer)
pal <- brewer.pal(9, "YlOrRd")
par(mfrow = c(1, 2))
# original version:
plot(1:length(pal), pch = 19, cex = 2, col = pal)
smoothed_palette <- smooth_pal(pal)
# smoothed version:
plot(1:length(smoothed_palette), pch = 19, cex = 2, col = smoothed_palette)

jdyeakel/paradox documentation built on May 18, 2019, 11:41 p.m.