geom_bezier: Cubic Bezier edge geometry

View source: R/geom-bezier.R

geom_bezierR Documentation

Cubic Bezier edge geometry

Description

Draw grouped cubic Bezier paths from four control points per group.

Usage

geom_bezier(
  mapping = NULL,
  data = NULL,
  n = 100,
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

Arguments

mapping

Set of aesthetic mappings created by aes().

data

A data frame containing x, y, and group.

n

Number of points sampled along each Bezier path.

stat

The statistical transformation used to process the layer data.

position

Position adjustment used to avoid overplotting.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, they are silently removed.

show.legend

Whether this layer should be drawn in the legends.

inherit.aes

Whether to inherit the aesthetic mappings of the plot. Defaults to FALSE, since each group must supply exactly the four control points of one Bezier curve.

...

Additional parameters passed to the layer.

Examples

library(ggplot2)
edges <- data.frame(
    x = c(0, 0.4, 1.6, 2),
    y = c(0, 1.2, 1.2, 0),
    group = 1
)
ggplot() + geom_bezier(aes(x, y, group = group), data = edges)

ggfun documentation built on Oct. 9, 2026, 5:07 p.m.