Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

colorRampPaletteAlpha

Color interpolation


Description

These functions are replacements for colorRamp and colorRampPalette from the package grDevices, the only difference being that they also interpolate the alpha channel (i.e. transparency).

Usage

colorRampPaletteAlpha(colors, ...)

colorRampAlpha(colors, bias = 1, interpolate = c("linear", "spline"))

Arguments

colors

colors to interpolate; must be a valid argument to col2rgb().

...

arguments to pass to colorRamp.

bias

a positive number. Higher values give more widely spaced colors at the high end.

interpolate

use spline or linear interpolation

Details

These functions are replacements for colorRamp and colorRampPalette from the package grDevices. There are two differences: (i) these functions also interpolate the alpha channel (i.e. transparency) and (ii) there is no space parameter (only rgb space is allowed). For all the other details, see descriptions of the original package.

Value

Both functions return a function which takes an integer argument. For details, see description of colorRampPalette

Examples

colorRampPaletteAlpha( c( "#FF000033", "#00FF0099" ) )( 5 )

riverplot

Sankey or Ribbon Plots

v0.10
GPL (>= 2.0)
Authors
January Weiner <january.weiner@gmail.com>
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.