
Last chance! 50% off unlimited learning
Sale ends in
Dotcharts, improved and extended
Dotchart1(x, labels=NULL, groups=NULL, gdata=NULL, 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, ...)Dotchart(...)
Dotchart3(values, left, right, pch=21, bg="white", pt.cex=1.2, lty=1, lwd=2,
gridcol="grey", ...)
Either a vector or matrix of numeric values. Inputs are coerced by 'as.numeric()', with a message.
A vector of labels for each point.
An optional factor indicating how the elements of 'x' are grouped.
Data values for the groups. This is typically a summary such as the median or mean of each group.
The character size to be used.
The 'cex' to be applied to plotting symbols.
The plotting character or symbol to be used.
The plotting character or symbol to be used for group values.
The background color of plotting characters.
The color(s) to be used for points and labels.
The single color to be used for group labels and values.
The color(s) to be used for the horizontal lines.
Horizontal range for the plot.
Overall title for the plot, see 'title'.
Axis annotations as in 'title'.
Centers for 'Dotchart3()'
Left margins for 'Dotchart3()'
Right margins for 'Dotchart3()'
Line type for 'Dotchart3()'
Line width for 'Dotchart3()'
Grid color for 'Dotchart3()'
Additional arguments
For better explanations of options, see 'help(dotchart)'.
'Dotchart1()' is a default 'dotchart()' corrected for use with 1-dimensional tables with 'ylab' and/or changed 'par("mar")[2]'. So comparing with the default 'dotchart()', it has a better left margin. It also outputs message instead of warning.
'Dotchart()' is a prettified 'Dotchart1()' with the following defaults: 'Dotchart1(lcolor="black", bg="white", pt.cex=1.2, ...)'. Use it as a shortcut.
'Dotchart3()' shows values together with ranges. It is an extension of 'Dotchart1()'; for each value, it shows ranges. Does not work with grouped data. A bit similar to 'Linechart()' but more general.
# NOT RUN {
## Compare:
aa <- table(c(1, 1, 1, 2, 2, 3))
##
Dotchart1(aa, ylab="Ylab") # shows ylab; outputs message instead of warning
dotchart(aa, ylab="Ylab") # does not show ylab; produces warning
##
## changes all margins (note: Dotchart1() cannot forcedly _decrease_ left margin)
old.par <- par(mar=c(1, 10, 1, 1)) ; Dotchart1(aa, ylab="Ylab") ; par(old.par)
## does not change left margin
old.par <- par(mar=c(1, 10, 1, 1)) ; dotchart(aa, ylab="Ylab") ; par(old.par)
Dotchart(aa)
Dotchart3(structure(1:3, names=LETTERS[1:3]), 0:2, 2:4)
Dotchart3(structure(0:2, names=LETTERS[1:3]), 0:2, 2:4, pch="") # ranges only
# }
Run the code above in your browser using DataLab