Learn R Programming

vcd (version 0.9-0)

legends: Legend Functions for Strucplots

Description

These functions generate legend functions for residual-based shadings.

Usage

legend_resbased(fontsize = 12,
  x = unit(1, "lines"), y = unit(0.1,"npc"),
  height = unit(0.8, "npc"),
  width = unit(0.7, "lines"),
  digits = 3, check_overlap = TRUE, text = NULL,
  steps = 200, ticks = 10, pvalue = TRUE)
legend_fixed(fontsize = 12, x = unit(1, "lines"), y = unit(0.2, "npc"),
  height = unit(0.8, "npc"), width = unit(1.5, "lines"),
  digits = 3, check_overlap = TRUE, text = NULL)

Arguments

fontsize
fontsize of title and p-value text.
x, y
objects of class "unit" indicating the coordinates of the title.
height, width
object of class "unit" indicating the height/width of the legend.
digits
number of digits for the scale labels.
check_overlap
logical indicating whether overlap of scale labels should be inhibited or not.
text
character string indicating the title of the legend.
steps
granularity of the color gradient.
ticks
number of scale ticks.
pvalue
logical indicating whether the $p$-value should be visualized under the scale or not.

Value

  • A function with arguments:
  • residualsresiduals from the fitted independence model to be visualized.
  • shadingshading function computing colors from residuals (see details).
  • autotextcharacter vector indicating the title to be used when no text argument is specified. Allows strucplot to generate sensible defaults depending on the residuals type.

Details

These functions generate legend functions for residual-based shadings, visualizing deviations from expected values of an hypothesized independence model. Therefore, the legend uses a supplied shading function to visualize the color gradient for the residuals range. For more details on the shading functions and their return values, see shadings.

References

D. Meyer, A. Zeileis, K. Hornik (2003), Visualizing independence using extended association plots. Proceedings of the 3rd International Workshop on Distributed Statistical Computing, K. Hornik, F. Leisch, A. Zeileis (eds.), ISSN 1609-395X. http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/

See Also

structable, shadings

Examples

Run this code
mosaic(Titanic, legend = legend_resbased)
mosaic(Titanic, legend = legend_fixed)

Run the code above in your browser using DataLab