View source: R/addExplanation.R
addExplanation | R Documentation |
Creates or adds an explanation, also called key or legend.
addExplanation(what, where = "new", title = expression(bold(EXPLANATION)), box.off = where != "new", margin = rep(0, 4), line.length = 2, line.height = 1.1)
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 |
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. |
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.
Nothing is returned.
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.