1-D Scatter Plots
stripchart produces one dimensional scatter plots (or dot
plots) of the given data. These plots are a good alternative to
boxplots when sample sizes are small.
# S3 method for formula stripchart(x, data = NULL, dlab = NULL, …, subset, na.action = NULL)
# S3 method for default stripchart(x, method = "overplot", jitter = 0.1, offset = 1/3, vertical = FALSE, group.names, add = FALSE, at = NULL, xlim = NULL, ylim = NULL, ylab = NULL, xlab = NULL, dlab = "", glab = "", log = "", pch = 0, col = par("fg"), cex = par("cex"), axes = TRUE, frame.plot = axes, …)
- the data from which the plots are to be produced. In the
default method the data can be specified as a single numeric
vector, or as list of numeric vectors, each corresponding to
a component plot. In the
formulamethod, a symbolic specification of the form
y ~ gcan be given, indicating the observations in the vector
yare to be grouped according to the levels of the factor
NAs are allowed in the data.
- a data.frame (or list) from which the variables in
xshould be taken.
- an optional vector specifying a subset of observations to be used for plotting.
- a function which indicates what should happen
when the data contain
NAs. The default is to ignore missing values in either the response or the group.
- additional parameters passed to the default method, or by
titleto control the appearance of the plot.
- the method to be used to separate coincident points.
The default method
"overplot"causes such points to be overplotted, but it is also possible to specify
"jitter"to jitter the points, or
"stack"have coincident points stacked. The last method only makes sense for very granular data.
method = "jitter"is used,
jittergives the amount of jittering applied.
- when stacking is used, points are stacked this many line-heights (symbol widths) apart.
- when vertical is
TRUEthe plots are drawn vertically rather than the default horizontal.
- group labels which will be printed alongside (or underneath) each plot.
- logical, if true add the chart to the current plot.
- numeric vector giving the locations where the charts should
be drawn, particularly when
add = TRUE; defaults to
nis the number of boxes.
- ylab, xlab
- labels: see
- dlab, glab
- alternate way to specify axis labels: see ‘Details’.
- xlim, ylim
- plot limits: see
- on which axes to use a log scale: see
- pch, col, cex
- Graphical parameters: see
- axes, frame.plot
- Axis control: see
Extensive examples of the use of this kind of plot can be found in
Box, Hunter and Hunter or Seber and Wild. The
glab labels may be used instead of
ylab if those are not specified.
dlab applies to the
continuous data axis (the X axis unless
glab to the group axis.
x <- stats::rnorm(50) xr <- round(x, 1) stripchart(x) ; m <- mean(par("usr")[1:2]) text(m, 1.04, "stripchart(x, \"overplot\")") stripchart(xr, method = "stack", add = TRUE, at = 1.2) text(m, 1.35, "stripchart(round(x,1), \"stack\")") stripchart(xr, method = "jitter", add = TRUE, at = 0.7) text(m, 0.85, "stripchart(round(x,1), \"jitter\")") stripchart(decrease ~ treatment, main = "stripchart(OrchardSprays)", vertical = TRUE, log = "y", data = OrchardSprays) stripchart(decrease ~ treatment, at = c(1:8)^2, main = "stripchart(OrchardSprays)", vertical = TRUE, log = "y", data = OrchardSprays)