在 R 编程中创建具有指定色调、饱和度和值的颜色向量 – hsv()函数
R 语言中的hsv()
函数用于从指定色调、饱和度和值的向量创建颜色向量。
Syntax: hsv(h, s, v)
Parameters:
h, s, v: numeric vectors of values in the range [0, 1] for ‘hue’, ‘saturation’ and ‘value’ to be combined to form a vector of colors.
示例 1:
# R program to illustrate
# hsv function
# Calling the hsv() function
hsv(0, 0, 0)
hsv(1, 1, 1)
输出:
[1] "#000000"
[1] "#FF0000"
示例 2:
# R program to illustrate
# hsv function
# Calling the hsv() function
hsv(0.1, 0.3, 0.5)
hsv(1, 0.08, 0.245)
输出:
[1] "#807059"
[1] "#3E3939"