symbols(x, y = NULL, circles, squares, rectangles, stars, thermometers, boxplots, inches = TRUE, add = FALSE, fg = par("col"), bg = NA, xlab = NULL, ylab = NULL, main = NULL, xlim = NULL, ylim = NULL, ...)
xy.coords
.NA
values
are replaced by zeroes.fg
) from their base to
this proportion of their height. If there are four columns, the
third and fourth columns are taken as proportions and the
thermometers are filled between these two proportions of their
heights. The part of the box not filled in fg
will be filled
in the background colour (default transparent) given by bg
.TRUE
, FALSE
or a positive number.
See ‘Details’.add
is TRUE
, the symbols are added to
an existing plot, otherwise a new plot is created.bg
being recycled to the number of symbols.
The default is to leave the symbols unfilled.add
is not true.
Defaults to the deparse
d expression used for x
.add = TRUE
.add = TRUE
.add = TRUE
.add = TRUE
.asp
(see plot.window
).NA
is reset
to zero. Argument inches
controls the sizes of the symbols. If
TRUE
(the default), the symbols are scaled so that the
largest dimension of any symbol is one inch. If a positive number is
given the symbols are scaled to make largest dimension this size in
inches (so TRUE
and 1
are equivalent). If inches
is FALSE
, the units are taken to be those of the appropriate
axes. (For circles, squares and stars the units of the x axis are
used. For boxplots, the lengths of the whiskers are regarded as
dimensions alongside width and height when scaling by inches
,
and are otherwise interpreted in the units of the y axis.)
Circles of radius zero are plotted at radius one pixel (which is
device-dependent). Circles of a very small non-zero radius may or may
not be visible, and may be smaller than circles of radius zero. On
windows
devices circles are plotted at radius at least one
pixel as some Windows versions omit smaller circles.
W. S. Cleveland (1985) The Elements of Graphing Data. Monterey, California: Wadsworth.
Murrell, P. (2005) R Graphics. Chapman & Hall/CRC Press.
stars
for drawing stars with a bit more
flexibility. If you are thinking about doing ‘bubble plots’ by
symbols(*, circles=*)
, you should really consider using
sunflowerplot
instead.
require(stats); require(grDevices)
x <- 1:10
y <- sort(10*runif(10))
z <- runif(10)
z3 <- cbind(z, 2*runif(10), runif(10))
symbols(x, y, thermometers = cbind(.5, 1, z), inches = .5, fg = 1:10)
symbols(x, y, thermometers = z3, inches = FALSE)
text(x, y, apply(format(round(z3, digits = 2)), 1, paste, collapse = ","),
adj = c(-.2,0), cex = .75, col = "purple", xpd = NA)
## Note that example(trees) shows more sensible plots!
N <- nrow(trees)
with(trees, {
## Girth is diameter in inches
symbols(Height, Volume, circles = Girth/24, inches = FALSE,
main = "Trees' Girth") # xlab and ylab automatically
## Colours too:
op <- palette(rainbow(N, end = 0.9))
symbols(Height, Volume, circles = Girth/16, inches = FALSE, bg = 1:N,
fg = "gray30", main = "symbols(*, circles = Girth/16, bg = 1:N)")
palette(op)
})
Run the code above in your browser using DataLab