sizetree               package:plotrix               R Documentation

_D_i_s_p_l_a_y _a _h_i_e_r_a_r_c_h_i_c_a_l _b_r_e_a_k_d_o_w_n _o_f _d_i_s_j_u_n_c_t _c_a_t_e_g_o_r_i_e_s

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

     Display a data frame in which the values in each successive column
     represent subcategories of the previous column as stacked
     rectangles.

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

      sizetree(x,left=0,top,right=1,lastcenter=NA,showval=TRUE,showcount=TRUE,
       firstcall=TRUE,col=NA,colorindex=1,...)

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

       x: A data frame in which each successive column represents
          subcategories of the previous column.

    left: The left edge of the current stack of rectangles in user
          units.

     top: The top of the current stack of rectangles in user units.

   right: The right edge of the current stack of rectangles in user
          units.

lastcenter: The center of the previous rectangle from which the next
          breakdown of categories arises. There is almost no reason to
          change it.

 showval: Whether to display the values representing the categories.

showcount: Whether to display the count for the categories.

firstcall: A flag for the function - do not alter this.

     col: Optional fill colors for the rectangles. See Details

colorindex: The index for 'col' if it is a list of color vectors.

     ...: additional arguments passed to 'plot'.

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

     'sizetree' displays disjunct hierarchical categories as stacked
     rectangles. It accepts a data frame in which the values in the
     first column represent categories, the values in the second column
     represent subcategories of the first column, and so on. The first
     column will be displayed as a stack of rectangles, the height of
     each proportional to the count for each category. Each substack of
     rectangles in the second stack will represent the breakdown of
     counts for its superordinate category and so on through the
     columns. Empty categories are ignored and NAs will produce gaps.

     Typically, the user will simply pass the data frame, which should
     only contain columns that are hierarchical categories, set
     'showval' and 'showcount' to the desired values, and pass colors
     for the top level categories if these are wanted. If colors are
     passed, it is best to have at least as many colors as there are
     categories in the first column or some will be recycled. If
     different colors are desired for different levels, as in the
     example, pass a list of colors.

     The 'firstcall' argument is necessary for the function to
     initialize the plot, as each breakdown involves a recursive call.
     If it is changed, the best that can be expected is an
     uninformative plot.

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

     nil

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

     Jim Lemon

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

     'plot','smoothColors'

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

      cat1<-sample(c("None","Low","Medium","High"),40,TRUE)
      cat2<-sample(c("None","Low","Medium","High"),40,TRUE)
      cat3<-sample(c("None","Low","Medium","High"),40,TRUE)
      hcats<-data.frame(cat1,cat2,cat3)
      bhcol<-list(c("#ff8080","#dddd80","#80ff80","#8080ff"),
       c("red","green","lightblue","yellow"),
       c("#ffffff","#bbbbbb","#999999","#666666"))
      sizetree(hcats,col=bhcol,main="Hierarchical count chart")

