dotchart
Cleveland's Dot Plots
Description
Draw a Cleveland dot plot.
Usage
dotchart(x, labels = NULL, groups = NULL, gdata = NULL, offset = 1/8, ann = par("ann"), xaxt = par("xaxt"), frame.plot = TRUE, log = "", cex = par("cex"), pt.cex = cex, pch = 21, gpch = 21, bg = par("bg"), color = par("fg"), gcolor = par("fg"), lcolor = "gray", xlim = range(x[is.finite(x)]), main = NULL, xlab = NULL, ylab = NULL, ...)
Arguments
x | either a vector or matrix of numeric values ( |
labels | a vector of labels for each point. For vectors the default is to use |
groups | an optional factor indicating how the elements of |
gdata | data values for the groups. This is typically a summary such as the median or mean of each group. |
offset | offset in inches of |
ann | a |
xaxt | a string indicating the x-axis style; use |
frame.plot | a logical indicating whether a box should be drawn around the plot. |
log | a character string indicating if one or the other axis should be logarithmic, see |
cex | the character size to be used. Setting |
pt.cex | the |
pch | the plotting character or symbol to be used. |
gpch | the plotting character or symbol to be used for group values. |
bg | the background color of plotting characters or symbols to be used; use |
color | the color(s) to be used for points and labels. |
gcolor | the single color to be used for group labels and values. |
lcolor | the color(s) to be used for the horizontal lines. |
xlim | horizontal range for the plot, see |
main | overall title for the plot, see |
xlab, ylab | axis annotations as in |
... | graphical parameters can also be specified as arguments. |
Value
This function is invoked for its side effect, which is to produce two variants of dotplots as described in Cleveland (1985).
Dot plots are a reasonable substitute for bar plots.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
Cleveland, W. S. (1985) The Elements of Graphing Data. Monterey, CA: Wadsworth.
Murrell, P. (2005) R Graphics. Chapman & Hall/CRC Press.
Examples
dotchart(VADeaths, main = "Death Rates in Virginia - 1940") op <- par(xaxs = "i") # 0 -- 100% dotchart(t(VADeaths), xlim = c(0,100), bg = "skyblue", main = "Death Rates in Virginia - 1940", xlab = "rate [ % ]", ylab = "Grouping: Age x Urbanity . Gender") par(op)
Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.