addExplanation: Add Explanation

View source: R/addExplanation.R

addExplanationR Documentation

Add Explanation

Description

Creates or adds an explanation, also called key or legend.

Usage

addExplanation(what, where = "new",
  title = expression(bold(EXPLANATION)), box.off = where != "new",
  margin = rep(0, 4), line.length = 2, line.height = 1.1)

Arguments

what

a specialized object for an explanation, from the output from calls to the plotting functions

where

a description of where to put the explanation, see Details.

title

the title of the explanation.

box.off

logical, if TRUE, then box off the explanation with a blank background and black box, otherwise the background is not blanked and no bounding box is drawn.

margin

the margin for a new graph

line.length

the relative length of lines drawn in the explanation, see Details.

line.height

the relative spacing of the lines in the explanation.

Details

The value for where must be one of "ul," "ur," "ll," "lr," "cl," "cr," "uc," "lc," "cc," or "new." If "new," then the explanation is placed in a new graph, otherwise, the first letter is an abbreviation for upper, lower, or center and the second letter is an abbreviation for left, right, or center. the explanation for a box plot, stiff diagram, or contour plot must be placed in a new graph. If box.off is TRUE, then the explanation abuts the axes, otherwise it is placed slightly inset so that the text does not interfere with the ticks.

In most cases, line.length does not need to be changed. In some cases, such as mass produced figures that will not be modified by an illustrator, the line.length can be increased to show full dashes if dashed lines are drawn. In gneralt, the illustrator should create dashed lines rather than drawing them in the graph.

Value

Nothing is returned.

Note

The call to addExplanation should be the last in any sequence of calls to construct a figure becuase it can alter some graphical parameters.
Box plot explanations require fairly large graph areas because of the detail required for some types. In general, a graph about 4.5 inches high is needed for the Tukey type and 4 inches for other types and widths of 2.5 and 2 inches respectively. The sizes are smaller for the font type of "USGS." If the graph area is smaller than required for the box plot explanation, then either a modified explanation is created or a warning is printed and the explanation may be unreadable.

Examples

## Not run: 
set.seed(1)
X <- rnorm(32)
Y <- X + rnorm(32)
setGD()
AA.pl <- xyPlot(X, Y, Plot=list(name="Random Points"))
addExplanation(AA.pl, where='ul')
# For more details of addExplanation see
vignette(topic="BoxPlots", package="smwrGraphs")
vignette(topic="GraphAdditions", package="smwrGraphs")
vignette(topic="GraphGallery", package="smwrGraphs")
vignette(topic="GraphSetup", package="smwrGraphs")
vignette(topic="LineScatter", package="smwrGraphs")
vignette(topic="PiperPlot", package="smwrGraphs")
demo(topic="Coplot-complexScatterPlot", package="smwrGraphs")
demo(topic="FlowDur-Measurements", package="smwrGraphs")
demo(topic="PiperScript", package="smwrGraphs")
demo(topic="RightAxisExample", package="smwrGraphs")

## End(Not run)

USGS-R/smwrGraphs documentation built on Oct. 11, 2022, 6:11 a.m.