labeling_cells_list           package:vcd           R Documentation

_L_a_b_e_l_i_n_g _F_u_n_c_t_i_o_n_s _f_o_r _S_t_r_u_c_p_l_o_t_s

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

     These functions generate labeling functions that produce labels
     for strucplots.

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

     labeling_cells(labels = TRUE, varnames = TRUE,
       abbreviate_labels = FALSE, abbreviate_varnames = FALSE,
       gp = gpar(), lsep = ": ", lcollapse = "\n",
       just = "center", pos = "center", rot = 0,
       margin = unit(0.5, "lines"), clip_cells = TRUE,
       text = NULL, ...)
     labeling_list(gp = gpar(), just = "left", pos = "left", lsep = ": ",
       sep = " ", offset = unit(c(2, 2), "lines"),
       varnames = TRUE, cols = 2, ...) 

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

  labels: vector of logicals indicating, for each dimension, whether
          labels for the factor levels should be drawn or not. Values
          are recycled as needed.

varnames: vector of logicals indicating, for each dimension, whether
          variable names should be drawn. Values are recycled as
          needed.

abbreviate_labels: vector of integers or logicals indicating, for each
          dimension, the number of characters the labels should be
          abbreviated to. 'TRUE' means 1 character, 'FALSE' causes no
          abbreviation. Values are recycled as needed.

abbreviate_varnames: vector of integers or logicals indicating, for
          each dimension, the number of characters the variable (i.e.,
          dimension) names should be abbreviated to. 'TRUE' means 1
          character, 'FALSE' causes no abbreviation. Values are
          recycled as needed.

      gp: object of class '"gpar"' used for the text drawn.

    lsep: character that separates variable names from the factor
          levels.

     sep: character that separates the factor levels (only used for
          'labeling_list').

  offset: object of class '"unit"' of length 2 specifying the offset in
          x- and y-direction of the text block drawn under the
          strucplot (only used for 'labeling_list').

    cols: number of text columns (only used for 'labeling_list').

lcollapse: character that separates several variable name/factor
          level-combinations.  Typically a line break. (Only used for
          'labeling_cells'.)

just, pos: character string of length 1 ('labeling_list') or at most 2
          ('labeling_cells') specifying the labels' horizontal position
          and justification (horizontal and vertical for
          'labeling_cells').

     rot: rotation angle in degrees, used for all labels (only used for
          'labeling_cells').

  margin: object of class '"unit"' (a numeric value is converted to
          '"lines"') specifying an offset from the cell borders (only
          used for 'labeling_cells').

clip_cells: logical indicating whether text should be clipped at the
          cell borders (only used for 'labeling_cells').

    text: Optionally, a character table of the same dimensions than the
          contingency table whose entries will then be used instead of
          the labels.  'NA' entries are not drawn. This allows custom
          cell annotations (see examples). Only used for
          'labeling_cells'.

     ...: Currently not used.

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

     These functions generate labeling functions that can add different
     kinds of labels to an existing plot. Typically they are  supplied
     to 'strucplot' which then generates and calls the labeling
     function. They assume that a strucplot has been drawn and the
     corresponding viewport structure is pushed, so that by  navigating
     through the viewport tree the labels can be positioned
     appropriately.

     This help page only documents 'labeling_list' and
     'labeling_cells'; more functions are described on the help page
     for 'labeling_border'.

     The functions can also be used 'stand-alone' as shown in the
     examples.

     Using 'labeling_list' will typically necessitate a bottom margin
     adjustment.

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

     A function with arguments: 

       d: '"dimnames"' attribute from the visualized contingency table,
          or the visualized table itself from which the '"dimnames"'
          attributes will then be extracted.

split_vertical: vector of logicals indicating the split directions.

condvars: integer vector of conditioning dimensions

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

     David Meyer David.Meyer@R-project.org

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

     'labeling_border',  'structable',  'grid.text'

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

     mosaic(Titanic, labeling = labeling_cells)
     mosaic(Titanic, labeling = labeling_list)

     ## A more complex example, adding the observed frequencies
     ## to a mosaic plot:
     tab <- ifelse(Titanic < 6, NA, Titanic)
     mosaic(Titanic, pop = FALSE)
     labeling_cells(text = tab, margin = 0)(Titanic)

