Learn R Programming

gplots (version 3.2.0)

adjust_hsv: Adjust Color in HSV Space

Description

Adjust color hue, saturation, and/or alpha value.

Usage

adjust_hsv(col, h=NULL, s=NULL, v=NULL, alpha=NULL)

Value

Adjusted colors in hexadecimal string format.

Arguments

col

a color or vector of colors.

h

the desired hue.

s

the desired saturation.

v

the desired value.

alpha

the desired transparency.

Author

Arni Magnusson.

Details

Colors can be specified as a color name, a hexadecimal string, or an integer.

Hue, saturation, value, and transparency are specified as values from 0 to 1, or NULL to leave unchanged.

See Also

col2rgb, rgb2hsv, and hsv are the underlying functions used to convert and adjust the colors.

Examples

Run this code
col <- "#123456"
col2 <- adjust_hsv(col, h=0.1)
col3 <- adjust_hsv(col, s=0.1)
col4 <- adjust_hsv(col, v=0.7)

barplot(rep(1, 4), col=c(col, col2, col3, col4))

Run the code above in your browser using DataLab