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)

