level.colors             package:lattice             R Documentation

_A _f_u_n_c_t_i_o_n _t_o _c_o_m_p_u_t_e _f_a_l_s_e _c_o_l_o_r_s _r_e_p_r_e_s_e_n_t_i_n_g _a _n_u_m_e_r_i_c _o_r
_c_a_t_e_g_o_r_i_c_a_l _v_a_r_i_a_b_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Calculates false colors from a numeric variable (including
     factors, using their numeric codes) given a color scheme and
     breakpoints.

_U_s_a_g_e:

     level.colors(x, at, col.regions, colors = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

       x: A numeric or 'factor' variable 

      at: A numeric variable of breakpoints where colors change 

col.regions: A specification of the colors to be used.  This could be
          either a vector of colors, or a function that produces a
          vector of colors when called with a single argument giving
          the number of colors. 

  colors: logical indicating whether colors should be computed and
          returned.  If 'FALSE', only the indices representing which
          interval (among those defined by 'at') each value in 'x'
          falls into is returned.  

     ...: Extra arguments, ignored. 

_V_a_l_u_e:

     A vector of the same length as 'x'.  Depending on the 'colors'
     argument, this could be either a vector of colors (in a form
     usable by R), or a vector of integer indices representing which
     interval the values of 'x' fall in.

_A_u_t_h_o_r(_s):

     Deepayan Sarkar deepayan.sarkar@r-project.org

_S_e_e _A_l_s_o:

     'levelplot'

_E_x_a_m_p_l_e_s:

     depth.col <-
         with(quakes, 
              level.colors(depth, at = do.breaks(range(depth), 30),
                           col.regions = terrain.colors))

     xyplot(lat ~ long | equal.count(stations), quakes,
            strip = strip.custom(var.name = "Stations"),
            colours = depth.col,
            panel = function(x, y, colours, subscripts, ...) {
                panel.xyplot(x, y, pch = 21, col = "transparent",
                             fill = colours[subscripts], ...)
            })

