grob_arrow_curve {ggarrow} | R Documentation |
Arrow curve grob.
Description
Creates a graphical object that draws curved arrows.
Usage
grob_arrow_curve(
x1,
y1,
x2,
y2,
default.units = "mm",
curvature = 1,
angle = 90,
ncp = 1,
shape = 0.5,
square = TRUE,
squareShape = 1,
inflect = FALSE,
open = TRUE,
name = NULL,
gp = gpar(),
vp = NULL,
...,
width_head = unit(1, "mm"),
width_fins = unit(1, "mm")
)
Arguments
x1 |
A numeric vector or unit object specifying the x-location of the start point. |
y1 |
A numeric vector or unit object specifying the y-location of the start point. |
x2 |
A numeric vector or unit object specifying the x-location of the end point. |
y2 |
A numeric vector or unit object specifying the y-location of the end point. |
default.units |
A string indicating the default units to use
if |
curvature |
A numeric value giving the amount of curvature. Negative values produce left-hand curves, positive values produce right-hand curves, and zero produces a straight line. |
angle |
A numeric value between 0 and 180, giving an amount to skew the control points of the curve. Values less than 90 skew the curve towards the start point and values greater than 90 skew the curve towards the end point. |
ncp |
The number of control points used to draw the curve. More control points creates a smoother curve. |
shape |
A numeric vector of values between -1 and 1, which
control the shape of the curve relative to its control points.
See |
square |
A logical value that controls whether control
points for the curve are created city-block fashion or
obliquely. When |
squareShape |
A |
inflect |
A logical value specifying whether the curve should be cut in half and inverted (see Examples below). |
open |
A logical value indicating whether to close the curve (connect the start and end points). |
name |
A character identifier. |
gp |
An object of class |
vp |
A Grid viewport object (or NULL). |
... |
Arguments passed on to
|
width_fins , width_head |
A |
Value
A <curve_arrow>
graphical object.
Examples
requireNamespace("grid")
# Creating the curved arrow
grob <- grob_arrow_curve(
x1 = unit(0.25, "npc"), y1 = unit(0.25, "npc"),
x2 = unit(0.75, "npc"), y2 = unit(0.75, "npc"),
angle = 90, curvature = 0.5, ncp = 5,
arrow_head = arrow_head_line()
)
# Drawing the arrow
grid::grid.newpage(); grid::grid.draw(grob)