hsv                package:grDevices                R Documentation

_H_S_V _C_o_l_o_r _S_p_e_c_i_f_i_c_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Create a vector of colors from vectors specifying hue, saturation
     and value.

_U_s_a_g_e:

     hsv(h = 1, s = 1, v = 1, gamma = 1, alpha)

_A_r_g_u_m_e_n_t_s:

   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.  Values in shorter arguments are recycled.

   gamma: a gamma-correction exponent, gamma

   alpha: numeric vector of values in the range '[0,1]' for alpha
          transparency channel (0 means transparent and 1 means
          opaque).

_D_e_t_a_i_l_s:

     Semi-transparent colors ('0 < alpha < 1') are supported only on
     some devices: see 'rgb'.

_V_a_l_u_e:

     This function creates a vector of colors corresponding to the
     given values in HSV space.  The values returned by 'hsv' can be
     used with a 'col=' specification in graphics functions or in
     'par'.

_G_a_m_m_a _c_o_r_r_e_c_t_i_o_n:

     For each color, (r,g,b) in RGB space (with all values in [0,1]),
     the final color corresponds to r^gamma, g^gamma, b^gamma).

_S_e_e _A_l_s_o:

     'hcl' for a perceptually based version of 'hsv()', 'rgb' and
     'rgb2hsv' for RGB to HSV conversion; 'rainbow', 'gray'.

_E_x_a_m_p_l_e_s:

     require(graphics)

     hsv(.5,.5,.5)

     ## Look at gamma effect:
     n <- 20;  y <- -sin(3*pi*((1:n)-1/2)/n)
     op <- par(mfrow=c(3,2),mar=rep(1.5,4))
     for(gamma in c(.4, .6, .8, 1, 1.2, 1.5))
       plot(y, axes = FALSE, frame.plot = TRUE,
            xlab = "", ylab = "", pch = 21, cex = 30,
            bg = rainbow(n, start=.85, end=.1, gamma = gamma),
            main = paste("Red tones;  gamma=",format(gamma)))
     par(op)

