Skip to contents

An extended version of coord_radial(), providing additional customization options.

Usage

coord_circle(
  theta = "x",
  start = 0,
  end = NULL,
  xlim = NULL,
  ylim = NULL,
  expand = FALSE,
  direction = 1,
  clip = "off",
  r.axis.inside = NULL,
  rotate.angle = FALSE,
  inner.radius = 0,
  outer.radius = 0.95
)

Arguments

theta

variable to map angle to (x or y)

start

Offset of starting point from 12 o'clock in radians. Offset is applied clockwise or anticlockwise depending on value of direction.

end

Position from 12 o'clock in radians where plot ends, to allow for partial polar coordinates. The default, NULL, is set to start + 2 * pi.

xlim, ylim

Limits for the x and y axes.

expand

If TRUE, the default, adds a small expansion factor the the limits to prevent overlap between data and axes. If FALSE, limits are taken directly from the scale.

direction

1, clockwise; -1, anticlockwise

clip

Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. For details, please see coord_cartesian().

r.axis.inside

If TRUE, places the radius axis inside the panel. If FALSE, places the radius axis next to the panel. The default, NULL, places the radius axis outside if the start and end arguments form a full circle.

rotate.angle

If TRUE, transforms the angle aesthetic in data in accordance with the computed theta position. If FALSE (default), no such transformation is performed. Can be useful to rotate text geoms in alignment with the coordinates.

inner.radius

A numeric in [0, 1) indicates the inner radius.

outer.radius

A numeric in (0, 1] indicates the outer radius. coord_radial() by default uses 0.8.

Examples

ggplot(mtcars, aes(disp, mpg)) +
    geom_point() +
    coord_circle(
        start = -0.4 * pi, end = 0.4 * pi,
        inner.radius = 0.3, outer.radius = 1
    )

ggplot(mtcars, aes(disp, mpg)) +
    geom_point() +
    coord_circle(
        start = -0.4 * pi, end = 0.4 * pi,
        inner.radius = 0.3, outer.radius = 0.5
    )