rainbow_hcl         package:colorspace         R Documentation(utf8)

_H_C_L _a_n_d _H_S_V _C_o_l_o_r _P_a_l_e_t_t_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Color palettes based on the HCL and HSV color spaces.

_U_s_a_g_e:

     rainbow_hcl(n, c = 50, l = 70, start = 0, end = 360*(n-1)/n,
       gamma = 2.4, fixup = TRUE, ...)

     sequential_hcl(n, h = 260, c. = c(80, 0), l = c(30, 90), power = 1.5,
       gamma = 2.4, fixup = TRUE, ...)
     heat_hcl(n, h = c(0, 90), c. = c(100, 30), l = c(50, 90), power = c(1/5, 1),
       gamma = 2.4, fixup = TRUE, ...)
     terrain_hcl(n, h = c(130, 0), c. = c(80, 0), l = c(60, 95), power = c(1/10, 1),
       gamma = 2.4, fixup = TRUE, ...)

     diverge_hcl(n, h = c(260, 0), c = 80, l = c(30, 90), power = 1.5,
       gamma = 2.4, fixup = TRUE, ...)
     diverge_hsv(n, h = c(240, 0), s = 1, v = 1, power = 1,
       gamma = 2.4, fixup = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

       n: the number of colors (>= 1) to be in the palette.

   c, c.: chroma value in the HCL color description.

       l: luminance value in the HCL color description.

   start: the hue at which the rainbow begins.

     end: the hue at which the rainbow ends.

       h: hue value in the HCL or HSV color description, has to be in
          [0, 360] for HCL and in [0, 1] for HSV colors.

       s: saturation value in the HSV color description.

       v: value value in the HSV color description.

   power: control parameter determining how chroma and luminance should
          be increased (1 = linear, 2 = quadratic, etc.).

   gamma: gamma value of the display.

   fixup: logical. Should the color be corrected to a valid RGB value
          before correction?

     ...: Other arguments passed to 'hex'.

_D_e_t_a_i_l_s:

     All functions compute palettes based on either the HCL
     ('polarLUV') or the HSV ('HSV') color space.

     'rainbow_hcl' computes a rainbow of colors (qualitative palette)
     defined by different hues given a single value of each chroma and
     luminance. It corresponds to 'rainbow' which computes a rainbow in
     HSV space.

     'sequential_hcl' gives a sequential palette starting at the full
     color HCL('h', 'c[1]', 'l[1]') through to a light color HCL('h',
     'c[2]', 'l[2]') by interpolation.

     'diverge_hcl' and 'diverge_hsv', compute  a set of colors
     diverging from a neutral center (grey or white, without color) to
     two different extreme colors (blue and red by default). This is
     similar to 'cm.colors'. For the diverging HSV colors, two hues 'h'
     are needed, a maximal saturation 's' and a fixed value 'v'. The
     saturation is then varied to obtain the diverging colors. For the
     diverging HCL colors, again two hues 'h' are needed, a maximal
     chroma 'c' and two luminances 'l'. The colors are then created by
     an interpolation between the  full color HCL('h[1]', 'c', 'l[1]'),
     a neutral color HCL('h', 0, 'l[2]') and the other full color
     HCL('h[2]', 'c', 'l[1]').

     The palette 'heat_hcl' gives an implementation of 'heat.colors' in
     HCL space. By default, it goes from a red to a yellow hue, while
     simultaneously going to lighter colors (i.e., increasing
     luminance) and reducing the amount of color (i.e., decreasing
     chroma). The 'terrain_hcl' palette simply calls 'heat_hcl' with
     different parameters, providing colors similar in spirit to
     'terrain.colors'. The lighter colors are not strictly HCL colors,
     though.

_V_a_l_u_e:

     A character vector with (s)RGB codings of the colors in the
     palette.

_A_u_t_h_o_r(_s):

     Achim Zeileis Achim.Zeileis@R-project.org

_R_e_f_e_r_e_n_c_e_s:

     Zeileis A., Hornik K. and Murrell P. (2009), Escaping RGBland:
     Selecting Colors for Statistical Graphics. _Computational
     Statistics & Data Analysis_, *53*, 3259-3270.
     doi:10.1016/j.csda.2008.11.033 Preprint available from <URL:
     http://statmath.wu-wien.ac.at/~zeileis/papers/Zeileis+Hornik+Murrell-2009.pdf>.

_S_e_e _A_l_s_o:

     'polarLUV', 'HSV', 'hex'

_E_x_a_m_p_l_e_s:

     ## convenience demo functions
     wheel <- function(col, radius = 1, ...)
       pie(rep(1, length(col)), col = col, radius = radius, ...) 

     pal <- function(col, border = "light gray")
     {
       n <- length(col)
       plot(0, 0, type="n", xlim = c(0, 1), ylim = c(0, 1), axes = FALSE, xlab = "", ylab = "")
       rect(0:(n-1)/n, 0, 1:n/n, 1, col = col, border = border)
     }

     ## qualitative palette
     wheel(rainbow_hcl(12))

     ## a few useful diverging HCL palettes
     par(mar = rep(0, 4), mfrow = c(4, 1))
     pal(diverge_hcl(7))
     pal(diverge_hcl(7, h = c(246, 40), c = 96, l = c(65, 90)))
     pal(diverge_hcl(7, h = c(130, 43), c = 100, l = c(70, 90)))
     pal(diverge_hcl(7, h = c(180, 70), c = 70, l = c(90, 95)))
     pal(diverge_hcl(7, h = c(180, 330), c = 59, l = c(75, 95)))
     pal(diverge_hcl(7, h = c(128, 330), c = 98, l = c(65, 90)))
     pal(diverge_hcl(7, h = c(255, 330), l = c(40, 90)))
     pal(diverge_hcl(7, c = 100, l = c(50, 90), power = 1))

     ## sequential palettes
     pal(sequential_hcl(12))
     pal(heat_hcl(12, h = c(0, -100), l = c(75, 40), c = c(40, 80), power = 1))
     pal(terrain_hcl(12, c = c(65, 0), l = c(45, 95), power = c(1/3, 1.5)))
     pal(heat_hcl(12, c = c(80, 30), l = c(30, 90), power = c(1/5, 1.5)))

     ## compare base and vcd palettes
     par(mfrow = c(2, 1))
     wheel(rainbow(12)); wheel(rainbow_hcl(12))
     pal(diverge_hcl(7, c = 100, l = c(50, 90))); pal(diverge_hsv(7))
     pal(diverge_hcl(7, h = c(180, 330), c = 59, l = c(75, 95))); pal(cm.colors(7))
     pal(heat_hcl(12)); pal(heat.colors(12))
     pal(terrain_hcl(12)); pal(terrain.colors(12))

