Enhanced Dot Chart
dotchart2
is an enhanced version of the dotchart
function
with several new options.
dotchart2(data, labels, groups=NULL, gdata=NA, horizontal=TRUE, pch=16, xlab='', ylab='', xlim=NULL, auxdata, auxgdata=NULL, auxtitle, lty=1, lines=TRUE, dotsize = .8, cex = par("cex"), cex.labels = cex, cex.group.labels = cex.labels*1.25, sort.=TRUE, add=FALSE, dotfont=par('font'), groupfont=2, reset.par=add, xaxis=TRUE, width.factor=1.1, lcolor='gray', leavepar=FALSE, axisat=NULL, axislabels=NULL, ...)
data |
a numeric vector whose values are shown on the x-axis |
labels |
a vector of labels for each point, corresponding to
|
groups |
an optional categorical variable indicating how
|
gdata |
data values for groups, typically summaries such as group medians |
horizontal |
set to |
pch |
default character number or value for plotting dots in dot charts. The default is 16. |
xlab |
x-axis title |
ylab |
y-axis title |
xlim |
x-axis limits. Applies only to |
auxdata |
a vector of auxiliary data given to |
auxgdata |
similar to |
auxtitle |
if |
lty |
line type for horizontal lines. Default is 1 for R, 2 for S-Plus |
lines |
set to |
dotsize |
|
cex |
see |
cex.labels |
|
cex.group.labels |
value of |
sort. |
set to |
add |
set to |
dotfont |
font number of plotting dots. Default is one. Use |
groupfont |
font number to use in drawing |
reset.par |
set to |
xaxis |
set to |
width.factor |
When the calculated left margin turns out to be faulty, specify a
factor by which to multiple the left margin as |
lcolor |
color for horizontal reference lines. Default is |
leavepar |
set to |
axisat |
a vector of tick mark locations to pass to |
axislabels |
a vector of strings specifying axis tick mark labels. Useful if transforming the data axis |
... |
arguments passed to |
dotchart
will leave par
altered if reset.par=FALSE
.
Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com
set.seed(135) maj <- factor(c(rep('North',13),rep('South',13))) g <- paste('Category',rep(letters[1:13],2)) n <- sample(1:15000, 26, replace=TRUE) y1 <- runif(26) y2 <- pmax(0, y1 - runif(26, 0, .1)) dotchart2(y1, g, groups=maj, auxdata=n, auxtitle='n', xlab='Y') dotchart2(y2, g, groups=maj, pch=17, add=TRUE) ## Compare with dotchart function (no superpositioning or auxdata allowed): ## dotchart(y1, g, groups=maj, xlab='Y') ## To plot using a transformed scale add for example ## axisat=sqrt(pretty(y)), axislabels=pretty(y)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.