labeling_border(labels = TRUE, varnames = labels, set_labels = NULL, set_varnames = NULL, tl_labels = NULL, alternate_labels = FALSE, 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_labs = FALSE, rep = TRUE, clip = FALSE, ...)
labeling_values(value_type = c("observed", "expected", "residuals"), suppress = NULL, digits = 1, clip_cells = FALSE, ...)
labeling_residuals(suppress = NULL, digits = 1, clip_cells = 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"), dep_varname = TRUE, boxes = NULL, clip = NULL, labbl_varnames = FALSE, rot_labels = rep.int(0, 4), pos_labels = c("left", "center", "left", "center"), just_labels = c("left", "left", "left", "center"), varnames = NULL, gp_varnames = gpar(fontsize = 12, fontface = 2), offset_varnames = c(0, -0.6, 0, 0), tl_labels = NULL, ...)
"gpar"
used for
drawing the labels."gpar"
used for
drawing the variable names."left"
,
"center"
, "right"
) for each of the variables."left"
, "center"
, "right"
) for each of the
four sides of the plot."left"
, "center"
, "right"
) for each of the
variables."left"
, "center"
, "right"
) for each of the
four sides of the plot."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."labels_varnames"
is TRUE
.TRUE
means 1 character, FALSE
causes no abbreviation.
Values are recycled as needed."top"
or
"bottom"
position of the labels (only used for
labeling_doubledecker
).c(-k,
k)
. The default for labeling residuals is
c(-2,2)
. Use suppress = 0
to show all non-zero values.labeling_conditional
and
labeling_doubledecker
: parameters
passed to labeling_cells
and labeling_border
.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.
labeling_residuals
is a trivial wrapper for
labeling_values
, which in turn calls labeling_border
by
additionally adding the observed or expected frequencies or residuals
to the cells.
vignette("strucplot")
.
labeling_cells
,
labeling_list
,
structable
,
grid.text
data("Titanic")
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_labs = 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))
## show frequencies
mosaic(Titanic, labeling = labeling_values)
Run the code above in your browser using DataLab