labeling_border             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 used for strucplots.

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

     labeling_border(labels = TRUE, varnames = labels,
       set_labels = NULL, set_varnames = NULL, 
       tl_labels = NULL, tl_varnames = NULL, gp_labels = gpar(fontsize = 12),
       gp_varnames = gpar(fontsize = 12, fontface = 2),
       rot_labels = c(0, 90, 0, 90), rot_varnames = c(0, 90, 0, 90),
       pos_labels = "center", pos_varnames = "center",
       just_labels = "center", just_varnames = pos_varnames,
       boxes = FALSE, fill_boxes = FALSE,
       offset_labels = c(0, 0, 0, 0), offset_varnames = offset_labels,
       labbl_varnames = NULL, labels_varnames = FALSE, sep = ": ",
       abbreviate = FALSE, rep = TRUE, clip = FALSE, ...)
     labeling_conditional(...)
     labeling_left(rep = FALSE, pos_varnames = "left",
       pos_labels = "left", just_labels = "left", ...)
     labeling_left2(tl_labels = TRUE, clip = TRUE, pos_varnames = "left",
       pos_labels = "left", just_labels = "left", ...)
     labeling_cboxed(tl_labels = TRUE, boxes = TRUE, clip = TRUE,
       pos_labels = "center", ...)
     labeling_lboxed(tl_labels = FALSE, boxes = TRUE, clip = TRUE,
       pos_labels = "left", just_labels = "left",
       labbl_varnames = FALSE, ...)
     labeling_doubledecker(lab_pos = c("bottom", "top"), ...)

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

  labels: vector of logicals indicating whether labels should be drawn
          for a particular dimension.

varnames: vector of logicals indicating whether variable names should
          be drawn for a particular dimension.

set_labels: An optional character vector with named components
          replacing the so-specified variable names. The component
          names must exacty match the variable names to be replaced.

set_varnames: An optional list with named components of character
          vectors replacing the labels of the so-specified variables.
          The component names must exacty match the variable names
          whose labels should be replaced.

tl_labels: vector of logicals indicating whether labels should be
          positioned on top (column labels) / left (row labels) for a
          particular dimension.

tl_varnames: vector of logicals indicating whether variable names
          should be positioned on top (column labels) / on left (row
          labels) for a particular dimension.

gp_labels: list of objects of class '"gpar"' used for drawing the
          labels.

gp_varnames: list of objects of class '"gpar"' used for drawing the
          variable names.

rot_labels: vector of rotation angles for the labels for each of the
          four sides of the plot.

rot_varnames: vector of rotation angles for the variable names for each
          of the four sides of the plot.

pos_labels: character string of label positions ('"left"', '"center"',
          '"right"') for each of the variables.

pos_varnames: character string of variable names positions ('"left"',
          '"center"', '"right"') for each of the four sides of the
          plot.

just_labels: character string of label justifications ('"left"',
          '"center"', '"right"') for each of the variables.

just_varnames: character string of variable names justifications
          ('"left"', '"center"', '"right"') for each of the four sides
          of the plot.

   boxes: vector of logicals indicating whether boxes should be drawn
          around the labels for a particular dimension.

fill_boxes: Either a vector of logicals, or a vector of characters, or
          a list of such vectors, specifying the fill colors for the
          boxes. '"TRUE"' and '"FALSE"' values are transformed into
          '"grey"' and '"white"', respectively. If 'fill_boxes' is
          atomic, each component specifies a basic color for the
          corresponding dimension. This color is transformed into its
          HSV representation, and the value is varied from 50% to 100%
          to give a sequential color palette for the levels. For 'NA'
          components, no palette is produced (no fill color). If
          'fill_boxes' is a list of vectors, each vector specifies the
          level colors of the corresponding dimension.

offset_labels, offset_varnames: numeric vector of length 4 indicating
          the offset of the labels (variable names) for each of the
          four sides of the plot.

labbl_varnames: vector of logicals indicating whether variable names
          should be drawn on the left (column variables) / on top (row
          variables) of the corresponding labels.

labels_varnames: vector of logicals indicating, for each dimension,
          whether the variable name should be added to the
          corresponding labels or not.

     sep: separator used if any component of '"labels_varnames"' is
          'TRUE'.

abbreviate: 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.

     rep: vector of logicals indicating, for each dimension, whether
          labels should be repeated for all conditioning strata, or
          appear only once.

    clip: vector of integers indicating, for each dimension, whether
          labels should be clipped to not overlap.

 lab_pos: character string switching between '"top"' or '"bottom"'
          position of the labels (only used for
          'labeling_doubledecker').

     ...: only used for 'labeling_conditional': parameters passed to
          'labeling_cells' and 'labeling_border'.

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

     These functions generate labeling functions called by 'strucplot'
     for their side-effect of adding labels to the plot. They suppose
     that a strucplot has been drawn and the corresponding viewport
     structure is pushed, since the positions of the viewports are used
     for the label positioning. Note that the functions can also be
     used 'stand-alone' as shown in the examples.

     All values supplied to vectorized arguments can be 'abbreviated'
     by using named components which override the default component
     values.  In addition, these defaults can be overloaded by the
     sequence of non-named components which are recycled as needed (see
     examples).

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

     'labeling_left', 'labeling_left2', 'labeling_cboxed', and
     'labeling_lboxed' are really just wrappers to 'labeling_border',
     and good examples for the parameter usage.

_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_cells',  'labeling_list',  'structable',  'grid.text'

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

     mosaic(Titanic)
     mosaic(Titanic, labeling = labeling_left)
     labeling_left

     mosaic(Titanic, labeling = labeling_cboxed)
     labeling_cboxed

     mosaic(Titanic, labeling = labeling_lboxed)
     labeling_lboxed

     data(PreSex)
     mosaic(~ PremaritalSex + ExtramaritalSex | Gender + MaritalStatus,
            data = PreSex,
            labeling = labeling_conditional)

     ## specification of vectorized arguments 
     mosaic(Titanic,
            labeling_args = list(abbreviate = c(Survived = TRUE)))

     mosaic(Titanic,
            labeling_args = list(clip = TRUE, boxes = TRUE,
                                 fill_boxes = c(Survived = "green", "red"))
     )

     mosaic(Titanic,
            labeling_args = list(clip = TRUE, boxes = TRUE,
                                 fill_boxes = list(Sex = "red", "green"))
     )

     mosaic(Titanic,
            labeling_args = list(clip = TRUE, boxes = TRUE,
                                 fill_boxes = list(Sex = c(Male = "red", "blue"), "green"))
     )

     ## change variable names
     mosaic(Titanic, labeling_args = list(set_varnames = c(Sex = "Gender")))

     ## change labels
     mosaic(Titanic, labeling_args = list(set_varnames = c(Survived = "Status"),
            set_labels = list(Survived = c("Survived", "Not Survived")), rep = FALSE))

