Learn R Programming

supraHex (version 1.10.0)

visColoralpha: Function to add transparent (alpha) into colors

Description

visColoralpha is supposed to add transparent (alpha) into colors.

Usage

visColoralpha(col, alpha)

Arguments

col
input colors. It can be vector of R color specifications, such as a color name (as listed by 'colors()), a hexadecimal string of the form "#rrggbb" or "#rrggbbaa"
alpha
numeric vector of values in the range [0, 1] for alpha transparency channel (0 means transparent and 1 means opaque)

Value

a vector of colors (after transparent being added)

See Also

visColormap

Examples

Run this code
# 1) define "blue-white-red" colormap
palette.name <- visColormap(colormap="bwr")

# 2) use the return function "palette.name" to generate 10 colors spanning "bwr"
col <- palette.name(10)

# 3) add transparent (alpha=0.5)
cols <- visColoralpha(col, alpha=0.5)

Run the code above in your browser using DataLab