dots {BHH2}  R Documentation 
Dots display
Description
The function adds to the current plot an onedimensional scatter plot with stacking similar to a stemleaf plot or histograms but using characters. .
Usage
dots(x = , y = 0.1, xlim = range(x,na.rm=TRUE), stacked = FALSE, hmax= 0.5,
base = TRUE, axes = FALSE, pch = 21, pch.size = "x", labels = NULL,
hcex = 1, cex = par("cex"), cex.axis = par("cex.axis"))
Arguments
x 
numeric vector to be displayed in the dot plot. 
y 
numeric. Height of the dots (characters) at the base level. By default

xlim 
numeric vector with 2 entries: 
stacked 
logical. If 
hmax 
numeric. The maximum height in user units. By default

base 
logical. If 
axes 
logical. If 
pch 
numeric or character. Character number or character to be used for the display. 
pch.size 
numeric. Character to be used to distribute the "dots" ( 
labels 
character vector. If 
hcex 
numeric. Expansion (shrink) factor for character height. See details. 
cex 
numeric. Expansion factor used for character display. See par. 
cex.axis 
numeric. Expansion factor used in case of labelling the axis. 
Details
Function dots
adds to the current plot a dot plot similar to a
stemandleaf plot using characters specified by pch
and
labels=NULL
. If labels
is not NULL
then it is
expected to be a character vector and will
will be used to display each of the points. Its use is repeated or cut short if necessary.
The function computes the width and height size using character pch.size
calling
strwidth
and strheight
, but displays pch
instead.
Mainly this is used when pch
is not given by a quoted character,
for example, pch=21
. Also, currently the par("mkh") is ignored so
hcex
is used to compute the "working" height of the characters:
hcex*strheight(pch.size,units="user")
. If stacked=TRUE
,
the base line is divided in subintervals of size strwidth(pch.size)
and computed the number of points in each subinterval. If maximum number
of stacked characters exceed hmax
then the characters are overlapped to
adjust their total height to hmax
.
Value
Invisible data frame with columns (x,y,labels). ‘x’ and ‘y’ are the coordinates in user units of each point and ‘labels’ the corresponding character displayed.
Author(s)
Ernesto Barrios
See Also
Examples
library(BHH2)
set.seed(4)
# Defines the height of the plot area between c(0,1)
dotPlot(rnorm(100),xlab="x")
x < rnorm(100)
# plots (possibly) overlapping points at y=0.3
dots(x,y=0.3)
# plots (possibly) overlapping points at y=0.4
dots(x,y=0.4,stacked=TRUE,base=FALSE)
# plots (hopefully) stacked points at y=0.5 allowing the dots to as high as 0.9
dots(x,y=0.5,stacked=TRUE,base=FALSE,hmax=.9)