Resizeable dot plots
dotplot.Rd
Flexible stacked-dot plots of relatively small samples, and provisions for identifying points. The dot plot is responsive to resizing of the plot window: a vertical resizing does not affect the vertical spacing of the dots, and a horizontal resizing may lead to re-binning to fit well within the range.
Usage
dot.plot(x, pch = 16, cex.dot = 1, spacing = 1, xlab, xlim = range(x), ...)
dot.id(env, height.id = 2, cex.id = 1, col.id = "black")
dot.mod(env, ...)
Arguments
- x
Numeric vector of values to be plotted.
- pch
Plotting character for the dots. Default is a filled circle.
- cex.dot
Size of dots relative to
par("cex")
.- spacing
Factor for adjusting the vertical spacing of stacked dots.
- xlab, xlim
The usual graphical parameters (see
par
), but used bydot.plot
ordot.id
.- env
Environment returned by
dot.plot
.- height.id
Height (in character heights) above the horizontal axis for displaying identification labels.
- cex.id, col.id
cex
andcol
settings for labeling identified points.- ...
In
dot.plot
, additional graphical parameters (seepar
) used in constructing the plot. Indot.mod
, parameters to modify, from amongcex.dot
,cex.id
,col.id
, andheight.id
.
Details
dot.id
and dot.mod
work only with interactive graphics devices.
The dot.id
works similarly to identify
, but all dots in a particular stack are identified at once. The user should click along the bottom row of dots. No labels are displayed until the user exits identify mode (and then it may be necessary to refresh the plot by resizing it slightly). Also, the points that are labeled may change if the plot is resized horizontally, because only the x values are actually identified.
The user may call dot.id(..., modify = FALSE)
more than once, if it is desired to change which values are identified.
After a call to dot.id
or (especially) to dot.mod
, the graph may need to be refreshed. There appears to be no standard way to do this, so the user may need to resize its window slightly.
Value
dot.plot
returns an environment that is used to hold information on points that are identified. dot.id
modifies this environment; it (invisibly) returns the currently identified x values. (These are values from the original call to dot.plot
, not their rounded values used in the plot.)
Examples
require("unrepx")
educ = swiss$Education
names(educ) = abbreviate(row.names(swiss))
dp <- dot.plot(educ, xlab = "Percent Post-Primary Education (Switzerland, 1888)")
if (FALSE) {
dot.id(dp)
dot.mod(dp, height.id = 3, cex.id = .5)
}