Learn R Programming

qualityTools (version 1.49)

dotPlot: Function to create a dot plot

Description

dotPlot creates a dot plot. For data in groups the dotPlot is displayed stacked in one or not-stacked in different plot regions.

Usage

dotPlot(x, group, xlim, ylim, col, xlab, ylab, pch, cex, breaks, stacked = TRUE, ...)

Arguments

x
vector with numeric values which should be plotted.
group
(optional) vector for grouping the values (see examples).
xlim
vector giving the lower and upper limit of the x-axis.
ylim
vector giving the lower and upper limit of the y-axis.
col
vector containing numeric values or strings for different colors for the groups in the dot plot.
xlab
a title for the x axis: title.
ylab
a title for the y axis: title.
pch
a vector of integers specifying symbols or a single character to be used for plotting points for the different groups in the dot plot.
cex
the amount by which points and symbols should be magnified relative to the default.
breaks
a vector giving the breakpoints for the binning of the values in x.
stacked
a logical vector specifying whether the single groups should be plotted in a stacked dot plot or in a single one. By default stacked is set to TRUE.
...
further graphical parameters (see par)

Value

  • dotPlot a invisible matrix containing NA's and numeric values representing values in a bin. The number of bins is given by the number of columns of the matrix.

Details

values in x are assigned to the bins defined by breaks. The actual binning is done using hist.

See Also

hist boxplot http://www.user.tu-berlin.de/kalicete/qualityTools/S4.html

Examples

Run this code
#create some data and grouping
x = rnorm(28)
g = rep(1:2, 14)

#dot plot with groups and no stacking
dotPlot(x, group = g, stacked = FALSE, pch = c(19, 20), main = "Non stacked dot plot")

#dot plot with groups and stacking
x = rnorm(28)
dotPlot(x, group = g, stacked = TRUE, pch = c(19, 20), main = "Stacked dot plot")

Run the code above in your browser using DataLab