Arrow annotation layer
annotate_arrow.Rd
This function mirrors annotate()
with the following
changes. First, the geom
argument is pre-populated with "arrow"
. Second,
several parameters from ggarrow are special-cased, because no warning needs
to be issued when they don't have length 1.
Usage
annotate_arrow(
geom = "arrow",
x = NULL,
y = NULL,
xmin = NULL,
xmax = NULL,
ymin = NULL,
ymax = NULL,
xend = NULL,
yend = NULL,
...,
na.rm = FALSE
)
Arguments
- geom
name of geom to use for annotation
- x, y, xmin, ymin, xmax, ymax, xend, yend
Positioning aesthetics. At least one of these must be specified.
- ...
Other arguments passed on to
layer()
. These are often aesthetics, used to set an aesthetic to a fixed value, likecolour = "red"
orsize = 3
. They may also be parameters to the paired geom/stat.- na.rm
If
FALSE
, the default, missing values are removed with a warning. IfTRUE
, missing values are silently removed.
See also
Other arrow geoms:
geom_arrow()
,
geom_arrow_chain()
,
geom_arrow_curve()
,
geom_arrow_segment()
Examples
# Annotate an arrow
ggplot() +
annotate_arrow(
x = c(0, 1), y = c(0, 1),
arrow_head = arrow_head_line(),
arrow_fins = arrow_fins_line(),
length_head = unit(5, "mm"),
length_fins = unit(5, "mm")
)
# Still works with other geoms as well
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() +
annotate_arrow("text", x = 4, y = 25, label = "Some text")