View source: R/legend-draw-ggarchery.R
draw_key_arrowpath | R Documentation |
ggplot2::draw_key_path
and displays all the requested arrowheads.This function replaces ggplot2::draw_key_path
and displays all the requested arrowheads.
draw_key_arrowpath(data, params, size)
data |
A single row data frame containing the scaled aesthetics to display in this key |
params |
A list of additional parameters supplied to the geom. |
size |
Width and height of key in mm. |
A grid grob.
library(ggplot2)
library(magrittr)
library(tidyr)
# Generate some dummy data
ten.points <- data.frame(line.no = rep(1:5, each = 2), x = runif(10), y = runif(10),
position = rep(c("start", "end"), 5))
five.segments <- ten.points %>% pivot_wider(names_from = position, values_from = c(x,y))
ggplot(five.segments) +
geom_point(data = ten.points, aes(x = x, y = y)) +
geom_segment(aes(x = x_start, xend = x_end, y = y_start, yend = y_end), arrow = arrow(),
key_glyph = draw_key_arrowpath)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.