x-y
location.
The symbols can be circles, squares, rectangles, star plots, thermometers,
or boxplots. The value of the argument specifying the symbol is a vector
or matrix that determines the relative size of the symbols, while the
inches
argument controls overall size.
symbols(x, y, circles, squares, rectangles, stars, thermometers, boxplots, add = F, inches = T)
Missing values (NA) are allowed. Points containing missing values are not plotted.
Exactly one of the arguments
circles
,
squares
,
rectangles
,
stars
,
thermometers
, or
boxplots
must be given.
n
columns, where
n
is the number of points
to a star. The matrix must be scaled from
0
to
1
.
Missing values are allowed, points containing missing values are treated
as zero.
FALSE
, a new plot is set up; if
TRUE
,
symbols are added to the existing plot.
FALSE
, the symbol parameters are interpreted as being in
units of
x
and
y
.
In this case,
circles
and
squares
give ovals and rectangles when measured
in inches.
If
TRUE
, the symbols are
scaled so that the largest symbol is approximately one inch in size. If a
number is given, the parameters are scaled so that
inches
is the size of the largest symbol in inches.
Graphical parameters may also be supplied as arguments to this function (see ). In addition, the high-level graphics arguments described under and the arguments to may be supplied to this function.
Background color (bg) is used to fill the polygons (symbols) and foreground color (fg) to draw the edge (polylines). The col parameter is not used.
The absolute size of the symbols on the plot is determined by the
inches
argument. The relative sizes are determined
by the vector or matrix which specify the symbols.
Takes two objects and uses an argument to define a set of symbols to plot
at the coordinates that the two objects define.
If the
add
optional argument is set to
TRUE
, the symbols are added
to the existing plot.
Cleveland, W. S. (1985). The Elements of Graphing Data. Wadsworth, Monterey, California.
The scaling for boxplots does not include the extent of the whiskers.
Use the graphics parameter
ylim
to force the y-axis to include all
of the whiskers.
# population of cities in US select <- c("Atlanta", "Atlantic City", "Bismarck", "Boise", "Dallas", "Denver", "Lincoln", "Los Angeles", "Miami", "Milwaukee", "New York", "Seattle") # assign locally for modification city.x <- city.x city.y <- city.y city.name <- city.name names(city.x) <- city.name names(city.y) <- city.name names(city.name) <- city.name pop <- c(426, 60, 28, 34, 904, 494, 129, 2967, 347, 741, 7072, 557) usa() # plot map of US symbols(city.x[select], city.y[select], circles = sqrt(pop), add = T) text(city.x[select], city.y[select], city.name[select], cex = .5) murder <- state.x77[,"Murder"] west <- state.center$x < -95 therm <- cbind(.4, 1, murder[west]/max(murder[west])) usa(xlim = c(94, 135), ylim = c(25, 52)) symbols(state.center$x[west], state.center$y[west], thermometers = therm, inches = .5, add = T) title(main = "Murder Rates in the Western U.S.") addCircles <- function(x, y, x.radii = NULL, y.radii=NULL, ...){ # add circles to a plot, centers at (x,y), # radii specified in either x or y coordinates if(length(x.radii)) symbols(x, y, circles = x.radii, add=T, ..., inches = max(x.radii) * par("uin")[1]) else symbols(x, y, circles = y.radii, add=T, ..., inches = max(y.radii) * par("uin")[2]) } plot(c(0,2), c(0,10)) symbols(1,1, circles=1, inches=F, add=T) symbols(1,3, squares=1, inches=F, add=T) addCircles(c(1,1), c(5,5), x.radii=c(.1,.2)) addCircles(c(1,1), c(7,7), y.radii=c(.1,.2))