Methods for structured objects.

Description

Print/plot and summary methods for class "structured" objects.

plot and print methods are the same for "structured" objects

Summary method for "structured" objects.

Print method for "summary.structured" objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## S3 method for class 'structured'
print(x, legendLoc = c("left", "right", "top", "bottom",
  "newpage"), legend = defaultStrucLegend, lbl = "PLOT STRUCTURE",
  abbrevLength = c(0, 0), ...)

## S3 method for class 'structured'
plot(x, legendLoc = c("left", "right", "top", "bottom",
  "newpage"), legend = defaultStrucLegend, lbl = "PLOT STRUCTURE",
  abbrevLength = c(0, 0), ...)

## S3 method for class 'structured'
summary(object, ...)

## S3 method for class 'summary.structured'
print(x, lbl = "PLOT STRUCTURE", ...)

Arguments

x, object

The object to be displayed or summarized.

legendLoc

An optional location of a legend describing the plot layout to be used as a legend on the trellis plot. Note that a text legend is always printed on the console. If used, this argument specified the position of a legend in the trellis display. It must be one of "left", "right", "top", "bottom", or "newpage" (case doesn't matter and matching is done using match.arg, so legendLoc can be abbreviated). Any of the first four of these will become the name of a component of the legend argument of the xyplot call, and so must not conflict with any in a legend argument that may already be part of the strucplot call.

If legendLoc = "newpage", the legend will be plotted centered on a new trellis page.

legend

A function that constructs a grob to use as a plot legend. It must accept at least 3 arguments named "struc", "legendLoc", and "abbrevLength", and also have a ... argument. The first three will be passed the structure attribute of the object to be plotted and the legendLoc and abbrevLength arguments of the print call. The ... argument will be passed the ... argument of the print call, so additional function arguments should be included there (as name = value pairs, as usual).

The default is the defaultStrucLegend function. Its Help file should be consulted for its full argument list.

lbl

Label for console legend. Default = "PLOT STRUCTURE"

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.

...

Further arguments to pass down to either the print methods, the legend function, or print.trellis. Care should be taken to ensure that the names of arguments do not conflict. Note that heading and miss arguments of defaultStrucLegend are also used by the console display.

Details

The print and plot methods produce a plot and informative legend for "structured" objects. The plot method is an alias for the print method. The summary method gives a simple summary of the object with a print

Note

Do not use the packet.panel argument of print.trellis, as this will totally mess up the display.

See Also

print.trellis, defaultStrucLegend

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require(datasets)
# quakes data
#
# Create and save plot
out <- strucplot(lat ~ long|cut(mag,5)*cut(depth,4), data = quakes,
  col="blue", main = "Earthquake locations, by magnitude and depth")

# Summary:
summary(out)

# Default output -- structure legend on console only
   print(out)

# Add legends to the plot on either right or bottom (note partial matching)
   print(out, legendLoc = "right")
   print(out, legendLoc = "b")
#
# Plot the legend by itself on a separate page
   print(out, legendLoc = "newp")
#
# Extra grid "gp" arguments to alter text appearance
   print(out, legendLoc = "b",col="blue",fontface = "italic", abbrev = 5)
#
# ******* Using the "abbrev" argument with the 'barley' data set ****
#
  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
  print(out)
#
# Abbreviate factor names and levels
  print(out, abbrev = c(3,4))
#
# abbreviate just the levels of 'site' and change the console legend title
  print(out, abbrev = list(site = c(0,4)), lbl = "Structure Key")
#
# Note that the 'abbreviate' argument is shared by console and plot
# legends; as are the optional 'heading' and 'miss' arguments
# by the 'defaultStrucLegend' function.
  print(out,abbrev = list(site = c(0,4)),legendLoc="t",
   heading = c("Left-Right", "Up-Down"))