barhier               package:plotrix               R Documentation

_D_i_s_p_l_a_y _a _s_e_t _o_f _h_i_e_r_a_r_c_h_i_c_a_l_l_y _a_s_s_o_c_i_a_t_e_d _v_a_r_i_a_b_l_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 a block of
     stacked rectangles.

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

      barhier(x,left=0,top,right=1,showval=TRUE,showcount=TRUE,firstcall=TRUE,
       col=NA,fade=FALSE,...)

_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.

 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.

    fade: Whether to incrementally decrease the saturation of the bar
          colors at each level.

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

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

     'barhier' displays 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.
     Currently, these colors will be "faded out" in successive stacks
     of rectangles toward white.

     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(LETTERS[1:4],40,TRUE)
      cat2<-paste(cat1,sample(1:4,40,TRUE),sep="")
      cat3<-paste(cat2,sample(letters[1:4],40,TRUE),sep="")
      hcats<-data.frame(cat1,cat2,cat3)
      barhier(hcats,col=c("#ff8080","#dddd80","#80ff80","#8080ff"),
       main="Hierarchical count chart",fade=TRUE)

