geom_arc: Arcs based on radius and radians

Description Usage Arguments Details Aesthetics Computed variables Author(s) See Also Examples

View source: R/arc.R

Description

This set of stats and geoms makes it possible to draw circle segments based on a centre point, a radius and a start and end angle (in radians). These functions are intended for cartesian coordinate systems and makes it possible to create circular plot types without using the coord_polar coordinate system.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
stat_arc(mapping = NULL, data = NULL, geom = "arc",
  position = "identity", na.rm = FALSE, show.legend = NA, n = 360,
  inherit.aes = TRUE, ...)

geom_arc(mapping = NULL, data = NULL, stat = "arc",
  position = "identity", n = 360, arrow = NULL, lineend = "butt",
  na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)

stat_arc2(mapping = NULL, data = NULL, geom = "path_interpolate",
  position = "identity", na.rm = FALSE, show.legend = NA, n = 360,
  inherit.aes = TRUE, ...)

geom_arc2(mapping = NULL, data = NULL, stat = "arc2",
  position = "identity", n = 360, arrow = NULL, lineend = "butt",
  na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)

stat_arc0(mapping = NULL, data = NULL, geom = "arc0",
  position = "identity", na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, ...)

geom_arc0(mapping = NULL, data = NULL, stat = "arc0",
  position = "identity", ncp = 5, arrow = NULL, lineend = "butt",
  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.

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.

n

the smoothness of the arc. Sets the number of points to use if the arc would cover a full circle

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.

arrow

specification for arrow heads, as created by arrow()

lineend

Line end style (round, butt, square)

ncp

the number of control points used to draw the arc with curveGrob. Determines how well the arc approximates a circle section

Details

An arc is a segment of a line describing a circle. It is the fundamental visual element in donut charts where the length of the segment (and conversely the angular span of the segment) describes the proportion of an entety.

Aesthetics

geom_arc understand the following aesthetics (required aesthetics are in bold):

Computed variables

x, y

The start coordinates for the segment

xend, yend

The end coordinates for the segment

curvature

The curvature of the curveGrob to match a circle

Author(s)

Thomas Lin Pedersen

See Also

geom_arc_bar for drawing arcs with fill

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Lets make some data
arcs <- data.frame(
  start = seq(0, 2*pi, length.out=11)[-11],
  end = seq(0, 2*pi, length.out=11)[-1],
  r = rep(1:2, 5)
)

# Behold the arcs
ggplot() + geom_arc(aes(x0=0, y0=0, r=r, start=start, end=end,
                        linetype=factor(r)),
                    data=arcs)

ggforce documentation built on July 10, 2018, 1:06 a.m.