Draw Circle Based on Arc

This set of stats and geoms makes it possible to draw circle segments based on a eye 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 ggplot2::coord_polar() coordinate system.

          stat_arc(   mapping =          NULL,   data =          NULL,   geom =          "arc",   position =          "identity",   na.rm =          FALSE,   prove.fable =          NA,   n =          360,   inherit.aes =          TRUE,          ...          )          geom_arc(   mapping =          Nothing,   data =          Nothing,   stat =          "arc",   position =          "identity",   north =          360,   arrow =          Goose egg,   lineend =          "butt",   na.rm =          FALSE,   show.legend =          NA,   inherit.aes =          True,          ...          )          stat_arc2(   mapping =          Cypher,   information =          NULL,   geom =          "path_interpolate",   position =          "identity",   na.rm =          FALSE,   show.fable =          NA,   n =          360,   inherit.aes =          TRUE,          ...          )          geom_arc2(   mapping =          Zippo,   data =          NULL,   stat =          "arc2",   position =          "identity",   n =          360,   arrow =          NULL,   lineend =          "butt",   na.rm =          Imitation,   show.legend =          NA,   inherit.aes =          TRUE,          ...          )          stat_arc0(   mapping =          NULL,   information =          Nix,   geom =          "arc0",   position =          "identity",   na.rm =          Fake,   bear witness.fable =          NA,   inherit.aes =          TRUE,          ...          )          geom_arc0(   mapping =          NULL,   data =          Null,   stat =          "arc0",   position =          "identity",   ncp =          5,   arrow =          Goose egg,   lineend =          "butt",   na.rm =          False,   evidence.legend =          NA,   inherit.aes =          True,          ...          )

Arguments

mapping

Set of aesthetic mappings created past aes() or aes_(). If specified and inherit.aes = True (the default), it is combined with the default mapping at the peak level of the plot. You must supply mapping if at that place is no plot mapping.

data

The data to exist displayed in this layer. There are 3 options:

If Cypher, the default, the information is inherited from the plot information as specified in the call to ggplot().

A data.frame, or other object, will override the plot information. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A office will be called with a single argument, the plot data. The return value must exist a information.frame, and volition exist used every bit the layer information. A function tin exist created from a formula (due east.thou. ~ head(.10, ten)).

geom

The geometric object to utilise display the data

position

Position aligning, either as a string, or the result of a call to a position adjustment office.

na.rm

If FALSE, the default, missing values are removed with a alarm. If True, missing values are silently removed.

prove.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE ever includes. It can also be a named logical vector to finely select the aesthetics to display.

n

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

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that ascertain both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().

...

Other arguments passed on to layer(). These are often aesthetics, used to set an artful to a stock-still value, similar color = "ruby-red" or size = 3. They may besides exist parameters to the paired geom/stat.

stat

The statistical transformation to utilise on the information for this layer, as a string.

pointer

Arrow specification, as created by grid::arrow().

lineend

Line end style (round, barrel, 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 chemical element in donut charts where the length of the segment (and conversely the athwart span of the segment) describes the proportion of an entety.

Aesthetics

geom_arc understand the post-obit aesthetics (required aesthetics are in bold):

  • x0

  • y0

  • r

  • start

  • end

  • color

  • size

  • linetype

  • blastoff

  • lineend

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

Run across besides

Examples

          

# Lets make some data arcs <- data.frame( start = seq(0, 2 * pi, length.out = 11)[- 11], end = seq(0, 2 * pi, length.out = 11)[- ane], r = rep(1 : two, 5) ) # Behold the arcs ggplot(arcs) + geom_arc(aes(x0 = 0, y0 = 0, r = r, start = start, end = end, linetype = factor(r)))

# Use the calculated index to map values to position on the arc ggplot(arcs) + geom_arc(aes(x0 = 0, y0 = 0, r = r, starting time = start, end = terminate, size = stat(index)), lineend = 'circular') + scale_radius() # linear size calibration

# The 0 version maps directly to curveGrob instead of computing the points # itself ggplot(arcs) + geom_arc0(aes(x0 = 0, y0 = 0, r = r, start = start, stop = end, linetype = gene(r)))

# The two version allows interpolation of aesthetics between the start and cease # points arcs2 <- data.frame( angle = c(arcs $ start, arcs $ end), r = rep(arcs $ r, 2), group = rep(1 : 10, 2), colour = sample(messages[1 : v], twenty, True) ) ggplot(arcs2) + geom_arc2(aes(x0 = 0, y0 = 0, r = r, end = angle, grouping = group, colour = colour), size = ii)

fullerbohnsting.blogspot.com

Source: https://ggforce.data-imaginist.com/reference/geom_arc.html

0 Response to "Draw Circle Based on Arc"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel