geom_arrow_curve {ggarrow} | R Documentation |
Curves with arrows
Description
This arrow geom can be used to draw curves from one point to oneanother with arrow heads or fins.
Usage
geom_arrow_curve(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
curvature = 0.5,
angle = 90,
ncp = 5,
arrow_head = arrow_head_wings(),
arrow_fins = NULL,
arrow_mid = NULL,
length = 4,
length_head = NULL,
length_fins = NULL,
length_mid = NULL,
justify = 0,
force_arrow = FALSE,
mid_place = 0.5,
resect = 0,
resect_head = NULL,
resect_fins = NULL,
lineend = "butt",
linejoin = "round",
linemitre = 10,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
... |
Other arguments passed on to
|
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. |
arrow_head , arrow_fins , arrow_mid |
A function call to one of the arrow ornament functions that can determine the shape of the arrow head, fins or middle (interior) arrows. |
length , length_head , length_fins , length_mid |
Determines the size of
the arrow ornaments.
|
justify |
A |
force_arrow |
A |
mid_place |
Sets the location of middle (interior) arrows, when applicable. Can be one of the following:
|
resect , resect_head , resect_fins |
A |
lineend |
Line end style (round, butt, square). |
linejoin |
Line join style (round, mitre, bevel). |
linemitre |
Line mitre limit (number greater than 1). |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Value
A <Layer>
ggproto object that can be added to a plot.
Aesthetics
geom_arrow()
understands the following aesthetics (required aesthetics are in bold):
-
arrow_fins
-
arrow_head
-
arrow_mid
-
resect_fins
-
resect_head
-
stroke_colour
-
stroke_width
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
See Also
Other arrow geoms:
annotate_arrow()
,
geom_arrow()
,
geom_arrow_chain()
,
geom_arrow_segment()
Examples
curve_data <- data.frame(
x1 = c(2.62, 1.835),
x2 = c(3.57, 5.250),
y1 = c(21.0, 33.9),
y2 = c(15.0, 10.4),
group = c("A", "B")
)
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
geom_arrow_curve(
aes(x = x1, y = y1, xend = x2, yend = y2,
colour = group, arrow_head = group),
data = curve_data,
curvature = -0.2, length_head = 10
)