ggforce (version 0.1.1)

geom_circle: Circles based on center and radius

Description

This set of stats and geoms makes it possible to draw circles based on a center point and a radius. In contrast to using geom_point, the size of the circles are related to the coordinate system and not to a separate scale. These functions are intended for cartesian coordinate systems and will only produce a true circle if coord_fixed is used.

Usage

stat_circle(mapping = NULL, data = NULL, geom = "circle", position = "identity", n = 360, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
geom_circle(mapping = NULL, data = NULL, stat = "circle", position = "identity", n = 360, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)

Arguments

mapping
Set of aesthetic mappings created by aes or aes_. If specified and inherit.aes = TRUE (the default), is combined with the default mapping at the top level of the plot. You only need to supply mapping if there isn't a mapping defined for the plot.
data
A data frame. If specified, overrides the default data frame defined at the top level of the plot.
geom,
stat Override the default connection between geom_arc and stat_arc.
position
Position adjustment, either as a string, or the result of a call to a position adjustment function.
n
The number of points on the generated path per circle.
na.rm
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders.
...
other arguments passed on to layer. There are three types of arguments you can use here:
  • Aesthetics: to set an aesthetic to a fixed value, like color = "red" or size = 3.
  • Other arguments to the layer, for example you override the default stat associated with the layer.
  • Other arguments passed on to the stat.
stat
The statistical transformation to use on the data for this layer, as a string.

Aesthetics

geom_arc understand the following aesthetics (required aesthetics are in bold):
  • x0
  • y0
  • r
  • color
  • fill
  • size
  • linetype
  • alpha
  • lineend

Computed variables

See Also

geom_arc_bar for drawing arcs with fill

Examples

Run this code
# Lets make some data
circles <- data.frame(
  x0 = rep(1:3, 3),
  y0 =  rep(1:3, each=3),
  r = seq(0.1, 1, length.out = 9)
)

# Behold the some circles
ggplot() + geom_circle(aes(x0=x0, y0=y0, r=r, fill=r), data=circles)

# Use coord_fixed to ensure true circularity
ggplot() + geom_circle(aes(x0=x0, y0=y0, r=r, fill=r), data=circles) +
  coord_fixed()


Run the code above in your browser using DataLab