DescTools (version 0.99.8.1)

PlotDotCI: Plot a Dotchart with Confidence Intervals

Description

Plot a dotchart with confidence intervals as segments. The reason for creating a new function for the job is the automated calculation of the axis limits, ensuring all error bars will be fully visible.

Usage

PlotDotCI(x, xlim = NULL, 
          pch = 21, pch.cex = 1, pch.col = "black", pch.bg = "grey50",
          lcol = "grey40", lwd = 2,
          args.legend = NULL, code = 3, lend = "butt", 
          mar = c(7.1, 4.1, 4.1, 2.1), ...)

Arguments

x
matrix with 3 columns, the first is used as x-values, the second is the left bound and the 3rd the right bound of the segment.
xlim
the x limits of the plot.
pch
a vector of plotting characters or symbols.
pch.cex
magnification to be used for plotting characters relative to the current setting of cex.
pch.col
the colors for points. If using 21 etc. this is the margins color of the point character.
pch.bg
the colors for points. If using 21 etc. this is the fill color of the point character.
lcol
the colors for lines.
lwd
the widths for the segments.
lend
the line end style. This can be specified as an integer or string, 0: "round", 1: "butt", 2: "square"
args.legend
list of additional arguments to be passed to the legend function. Use args.legend = NA if no legend should be added.
code
integer value. Determines the kind of arrows to be drawn. code = 1 means that a lower arrowhead will be drawn, code = 2 will produce one on the right side and code = 3 on both sides. (See the function
mar
numeric vector with margins defined.
...
further arguments are passed to the function dotchart.

See Also

PlotDotCIp

Examples

Run this code
xci <- do.call(rbind, tapply( d.pizza$delivery_min, d.pizza$driver, 
  MeanCI, conf.level=0.99, na.rm=TRUE))

PlotDotCI(xci, main="delivery_min ~ driver", 
  args.legend=list(y=-1.5, legend=c("estimate", "99%-CI")))

Run the code above in your browser using DataCamp Workspace