Learn R Programming

itsadug (version 2.0)

dotplot_error: Utility function

Description

Adjusted version of the a Cleveland dot plot implemented in dotchart with the option to add confidence intervals.

Usage

dotplot_error(x, se.val = NULL, labels = NULL, groups = NULL,
  gdata = NULL, cex = par("cex"), pch = 21, gpch = 21, bg = "black",
  color = par("fg"), gcolor = par("fg"), lcolor = "gray", xlim = NULL,
  main = NULL, xlab = NULL, ylab = NULL, lwd = 1, ...)

Arguments

x
either a vector or matrix of numeric values (NAs are allowed). If x is a matrix the overall plot consists of juxtaposed dotplots for each row. Inputs which satisfy is.numeric(x) but not is.vector(x) || is.matrix( x) are coerced by as.numeric, with a war
se.val
a vector or matrix of numeric values representing the standard error or confidence bands.
labels
a vector of labels for each point. For vectors the default is to use names(x) and for matrices the row labels dimnames(x)[[1]].
groups
an optional factor indicating how the elements of x are grouped. If x is a matrix, groups will default to the columns of x.
gdata
data values for the groups. This is typically a summary such as the median or mean of each group.
cex
the character size to be used. Setting cex to a value smaller than one can be a useful way of avoiding label overlap. Unlike many other graphics functions, this sets the actual size, not a multiple of par("cex").
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 par(bg= *) to set the background color of the whole plot.
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 plot.window, e.g.
main
overall title for the plot, see title.
xlab
x-axis annotation as in title.
ylab
y-axis annotation as in title.
lwd
with of error bars.
...
graphical parameters can also be specified as arguments see par

See Also

dotchart

Other Functions for plotting: addInterval, add_bars, alphaPalette, alpha, check_normaldist, color_contour, drawArrows, emptyPlot, errorBars, fadeRug, fill_area, getCoords, getFigCoords, getProps, gradientLegend, marginDensityPlot, plot_error, plot_image, plotsurface, rug_model

Examples

Run this code
data(simdat)
avg <- with(simdat, 
     aggregate(list(Y=Y), list(Group=Group, Condition=Condition), 
         function(x){c(mean=mean(x), sd=sd(x))}))
dotplot_error(avg$Y[,'mean'], se.val=avg$Y[,'sd'], 
    groups=avg$Group, labels=avg$Condition)

Run the code above in your browser using DataLab