Draws bubbleblots – trivariate plots where the third dimension is mapped to the size of the points drawn on the screen.
Usage
bubbleplot(x, data = NULL, ...)
# S3 method for class 'formula'
bubbleplot(
x,
data = NULL,
maxsize = 3,
bubblekey = TRUE,
panel = panel.bubbleplot,
groups = NULL,
subset = TRUE,
drop.unused.levels = lattice.getOption("drop.unused.levels"),
...,
outer,
allow.multiple
)
Arguments
- x
A formula of the form
z ~ x * y
, wherex
andy
have the usual interpretation in trellis graphics (seelattice::xyplot()
) andz
is mapped to the size of bubbles.- data
A data.frame, list or environment wherein the formula and groups arguments can be evaluated.
- ...
Further arguments to pass to
lattice::xyplot()
.- maxsize
Maximum size (in cex) for the bubbles.
- bubblekey
Set to
TRUE
to draw an informative legend about the bubbles. Useslattice::draw.key()
. See the key section of the documentation inlattice::xyplot()
. If bothauto.key
andbubblekey
are given and theirspace
arguments (positions) conflict, bubblekey will silently override the position ofauto.key
.- panel
See
lattice::xyplot()
. Here, we are passing an additional variable,z
, which is then used inpanel.bubbleplot()
.- groups
- subset
- drop.unused.levels
- outer
Ignored.
- allow.multiple
Ignored.
Value
An object of class "trellis"
. The
update
method can be used to
update components of the object and the
print
method (usually called by
default) will plot it on an appropriate plotting device.
Examples
bubbleplot(disp ~ hp * wt, groups = cyl, data = mtcars, auto.key = TRUE)
bubbleplot(disp ~ hp * mpg | factor(cyl), groups = gear, data = mtcars,
auto.key = TRUE)