View source: R/annotate_arrow.R
annotate_arrow | R Documentation |
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.
annotate_arrow(
geom = "arrow",
x = NULL,
y = NULL,
xmin = NULL,
xmax = NULL,
ymin = NULL,
ymax = NULL,
xend = NULL,
yend = NULL,
...,
na.rm = FALSE
)
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
|
na.rm |
If |
A <Layer>
ggproto object that can be added to a plot.
Other arrow geoms:
geom_arrow()
,
geom_arrow_chain()
,
geom_arrow_curve()
,
geom_arrow_segment()
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.