discrete_arrow_scales | R Documentation |
These scales can map discrete input to various sorts of arrow shapes. The arrow head, arrow fins and middle arrows have separate scales.
scale_arrow_head_discrete(values = NULL, aesthetics = "arrow_head", ...)
scale_arrow_fins_discrete(values = NULL, aesthetics = "arrow_fins", ...)
scale_arrow_mid_discrete(values = NULL, aesthetics = "arrow_mid", ...)
A <Scale>
that can be added to a plot.
# A standard arrow plot
p <- ggplot(whirlpool(5), aes(x, y, colour = group)) +
geom_arrow(length_head = 10, length_fins = 10, arrow_head = NULL)
# A character vector naming arrow shapes as arrow head scale
p + aes(arrow_head = group) +
scale_arrow_head_discrete(values = c(
"head_wings", "head_line", "head_minimal", "fins_line", "fins_feather"
))
# A mixed list with arrows as arrow fins scale
p + aes(arrow_fins = group) +
scale_arrow_fins_discrete(values = list(
"head_wings", # Using a character
arrow_head_wings(20, 100), # Using an arrow function
NULL, # No arrow
matrix(c(1, 0, 0, 0, 0.5, -0.5), ncol = 2), # A matrix
"fins_feather"
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.