Learn R Programming

BHH2 (version 0.2-2)

dotPlot: Dot plot: scatter plot with stacked dots similar to the stem-and-leaf plot

Description

Displays an one-dimensional scatter plot with stacking similar to stem-and-leaf plot or histograms.

Usage

dotPlot(x, y = 0, xlim = range(x,na.rm=TRUE), xlab = NULL, 
    scatter = FALSE, hmax = 1, base = TRUE, axes = TRUE, frame = 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.
y
numeric. Height of the basis of the plot.
xlim
numeric. Range of the x axis.
xlab
character string. label for the horizontal axis.
scatter
logical. If TRUE a one-dimensional scatter plot of x, similar to rug, is displayed at the base of the plot.
hmax
numeric. Height of the highest dot. hmax=1 as default. See Details.
base
logical. If TRUE (default) a base line for the dots (characters) is displayed.
axes
logical. If TRUE labelled axis is displayed.
frame
logical. If FALSE the plot frame is omitted.
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" (pch). See Details.
labels
character vector. If NULL (default) each point (dot) is displayed using character pch, otherwise vector labels is used for the display. See Details.
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.
...
additional graphical parameters.

Value

  • The function is called for its side effect which is to produce one-dimensional scatter plot with stacking as described, for example, in Chambers et al. (1983) It returns invisible a data frame with the actual coordinates (in users units).

Details

Basically function dotPlot calls function dots to display a stacked one-dimensional scatter plot within vertical limits 0 and 1. See dots for more details.

References

Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P. A. (1983) Graphical Methods for Data Analysis. New York: Chapman & Hall

See Also

dots, stem,hist,dotchart

Examples

Run this code
library(BHH2)
data(tab03B1)
attach(tab03B1)
stem(yield) #stem-leaf plot
plt <- dotPlot(yield) # equivalent dotPlot

# same dot plot with max and min observations labelled
plt <- dotPlot(yield,xlim=c(75,95),xlab="yield",pch.size="x",hcex=1)
text(c(min(yield),max(yield),80),rep(0.05,3),c("min","max",80))
segments(80,min(plt$y),80,max(plt$y),lty=2)
detach()

Run the code above in your browser using DataLab