circles: Draw Circles on a Plot

View source: R/circles.R

circlesR Documentation

Draw Circles on a Plot

Description

Draw circles on a plot, with control over circle size.

Usage

circles(
  x,
  y,
  z,
  data.range = range(z, na.rm = TRUE),
  circle.size.range = c(0.1, 1),
  outx = NA,
  outy = NA,
  add = FALSE,
  xlim = NULL,
  ylim = NULL,
  ...
)

Arguments

x

Numeric vector of x coordinates.

y

Numeric vector of y coordinates.

z

Numeric vector of data used to inform the radii of the drawn circles. In general, this should be the square root of the quantity that you want to represent, because viewers will tend to judge the circles by their area not their radii.

data.range

Numeric vector, length 2, minimum and maximum zz data to plot, default range(z, na.rm=TRUE).

circle.size.range

Numeric vector, length 2, minimum and maximum circle radii in inches, default 0.1 to 1.

outx

Numeric scalar of x coordinate beyond the figure margins, default NA (see details).

outy

Numeric scalar of y coordinate beyond the figure margins, default NA (see details).

add

Logical scalar specifying if circles are added to existing plot (TRUE), default FALSE (a new plot is created).

xlim

Numeric vector, length 2, x-axis limits, unused if add=TRUE.

ylim

Numeric vector, length 2, y-axis limits, unused if add=TRUE.

...

Additional parameters supplied to the symbols function.

Details

The size of the circles plotted corresponds directly with the range of data. For example, if there is a z of size data.range[1], it will be plotted as a circle with radius circle.size.range[1], and if there is a z of size data.range[2], it will be plotted as a circle with radius circle.size.range[2].

The default of NA for outx and outy places unseen smallest and biggest circles at a location where the x and y coordinates are 10 times the range observed plus the maximum observed. In most instances this should be well beyond the figure margins.

Value

A data frame with the name, class, dimension, and size of each member of the environment.

Examples

circles(trees$Height, trees$Girth, sqrt(trees$Volume),
 data.range=sqrt(c(0, max(trees$Volume))), circle.size.range=c(0, 0.3),
 xlab="Height (ft)", ylab="Diameter (in)", main="Tree Volume")

JVAdams/GLFC documentation built on Jan. 5, 2023, 12:59 a.m.