Default legend function for strucplot displays.

Description

A structure legend is always printed on the console. It can also be optionally added to the trellis plot. This function constructs a default legend for this option.

Usage

1
2
3
4
defaultStrucLegend(struc, legendLoc = c("top", "right", "bottom", "left",
  "newpage"), legendLab = NA, heading = c("Horizontal", "Vertical"),
  miss = "No Conditioning", abbrevLength = c(0, 0), cex.font = 1,
  cex.lab = 1.25, col = "black", ...)

Arguments

struc

The "structure" attribute of a strucplot object

legendLoc

One of c("top","right","bottom","left","newpage") The first 4 specify on which side of the trellis display to place the legend. The last indicates that the legend will be plotted at the center of a separate page.

legendLab

A character string title for the legend. A value of NA omits the title. Default = NA

heading

A character vector of length 2 giving the headings for the horizontal and vertical conditioning variables portions of the legend. Default = c("Horizontal", "Vertical").

miss

A character string to use when there is no conditioning either horizontally or vertically. Default = "No Conditioning"

abbrevLength

Default = c(0,0). Either a length 2 vector or a named list to control lengths of factor names and levels in the legend. If a length 2 vector, it gives the minlength argument for the abbreviate function for abbreviating all the factor names and their levels, in that order. A value of 0 for either means "don't abbreviate." For back compatibility, a single numeric y will also be accepted and changed to c(y,0). If a named list, the names must be those of of the conditioning factors to abbreviate, and values length 2 vectors as above to control abbreviation lengths for the corresponding factor names and levels.

cex.font

Multiplier for text font size in a trellis legend. Default = 1.

cex.lab

Multiplier for legend title font size in a trellis legend. Default = 1.25.

col

Text color for text in a trellis legend. Default = "black".

...

Additional arguments to be used in a gp list for controlling text appearance in a trellis legend. See gpar for possibilities.

Value

A text grob that can be included as part of the strucplot trellis plot.

See Also

print.structured

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Controlling the console and plot legends
 library(datasets) ## for the barley data
#
 out <- strucplot(variety~yield|year*site,data=barley, horizontal=TRUE,
   panel=panel.dotplot, col = "darkblue",
   scales = list(alternat = 1, y = list(cex=.5)),
   spacings = list(x=0, y=.5))
#
# Default with legend on top; note that no title is the plot legend default
  print(out, legendLoc = "t", abbrev= list(site = c(0,4)))
#
# Include title on plot and reduce default font sizes in red text
  print(out, legendLoc = "T", abbrev = list(site = c(0,6)),
   legendLab = "Structure", cex.lab = 1, cex.font = .75, col = "darkred" )