findColours             package:classInt             R Documentation

_a_s_s_i_g_n _c_o_l_o_u_r_s _t_o _c_l_a_s_s_e_s _f_r_o_m _c_l_a_s_s_I_n_t_e_r_v_a_l _o_b_j_e_c_t

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

     This helper function is a wrapper for 'findCols' to extract
     classes from a "classInterval" object and assign colours from a
     palette created by 'colorRampPalette' from the two or more colours
     given in the 'pal' argument. It also returns two attributes for
     use in constructing a legend.

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

     findColours(clI, pal, under="under", over="over", between="-", digits = getOption("digits"), cutlabels=FALSE)

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

     clI: a "classIntervals" object

     pal: a character vector of at least two colour names;
          'colorRampPalette' is used internally to create the required
          number of colours

   under: character string value for "under" in legend

    over: character string value for "over" in legend

 between: character string value for "between" in legend

  digits: minimal number of significant digits in legend

cutlabels: use cut-style labels in legend

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

     a character vector of colours with attributes: "table", a named
     frequency table; "palette", a character vector of colours
     corresponding to the specified breaks.

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

     Roger Bivand <Roger.Bivand@nhh.no

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

     'classIntervals', 'findInterval', 'findCols', 'colorRampPalette'

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

     data(jenks71)
     mypal <- c("wheat1", "red3")
     h5 <- classIntervals(jenks71$jenks71, n=5, style="hclust", method="complete")
     findColours(h5, mypal)
     findColours(getHclustClassIntervals(h5, k=7), mypal)
     h5Colours <- findColours(h5, mypal)
     plot(h5, mypal, main="Complete hierarchical clustering")
     legend(c(95, 155), c(0.12, 0.4), fill=attr(h5Colours, "palette"), legend=names(attr(h5Colours, "table")), bg="white")
     h5tab <- attr(h5Colours, "table")
     legtext <- paste(names(h5tab), " (", h5tab, ")", sep="")
     plot(h5, mypal, main="Complete hierarchical clustering (with counts)")
     legend(c(95, 165), c(0.12, 0.4), fill=attr(h5Colours, "palette"), legend=legtext, bg="white")

