add.segments | R Documentation |
Adds horizontal line segments to an existing plot. The segments are
centered at x
with height y
. The x
values are
assumed to be equally spaced, so that diff(x)
is a constant
'dx
'. The line segments go from x +/- half.width.factor
*dx
, so if half.width.factor=.5
there will be no gaps between
segments. The default is to leave a small gap.
This function was originally used to add reference lines to side-by-side boxplots.
AddSegments(x, y, half.width.factor = 0.45, ...)
x |
A numeric vector giving the midpoints of the line segments. |
y |
A numeric vector of the same length as |
half.width.factor |
See 'description' above. |
... |
graphical parameters controlling the type of lines used in the line segments |
Called for its side effect.
Steven L. Scott
boxplot.true
x <- rnorm(100)
y <- rnorm(100, 1)
boxplot(list(x=x,y=y))
AddSegments(1:2, c(0, 1)) ## add segments to the boxplot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.