Learn R Programming

painter (version 0.1.0)

SetOpacity: Modify the opacity, hue, saturation or value of color(s)

Description

Change the charactistics of a color or vector of colors

Usage

SetOpacity(color,opacity)
SetHue(color,hue)
SetSaturation(color,saturation)
SetValue(color,value)

Arguments

color

a vector of colors

opacity

a vector of new opacity values

hue

a vector of new hues

saturation

a vector of new saturations

value

a vector of new values

Value

A vector of colors of length n.

Details

These functions accept colors specified by name (e.g. "red") or hex codes (e.g. "FF0000"). If the color argument and the other argument both have length n, then each color will be assigned the corresponding new opacity, hue, saturation or value. Otherwise, at least one of the arguments should have length 1, in which case each it will be recycled to length n.

Examples

Run this code
# NOT RUN {
TestPalette(SetOpacity("red",seq(0,1,0.02)))
TestPalette(SetHue("red",seq(0,1,0.02)))
TestPalette(SetSaturation("red",seq(0,1,0.02)))
TestPalette(SetValue("red",seq(0,1,0.02)))

x = runif(200)
y = runif(200)
color = SetHue("red",x)
color = SetValue(color,y)
plot(x,y,col = color,pch = 16,cex = 2)

# }

Run the code above in your browser using DataLab