Skip to content
Related Articles

Related Articles

Create a Vector of Colors with specified Hue, Saturation and Value in R Programming – hsv() Function
  • Last Updated : 30 Jun, 2020

hsv() function in R Language is used to create a vector of colors from vectors specifying hue, saturation and value.

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.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# R program to illustrate
# hsv function
  
# Calling the hsv() function
hsv(0, 0, 0)
hsv(1, 1, 1)

chevron_right


Output:

[1] "#000000"
[1] "#FF0000"

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# R program to illustrate
# hsv function
  
# Calling the hsv() function
hsv(0.1, 0.3, 0.5)
hsv(1, 0.08, 0.245)

chevron_right


Output:

[1] "#807059"
[1] "#3E3939"
My Personal Notes arrow_drop_up
Recommended Articles
Page :