This function adds a text annotation layer

stamp_segment(
  x = 0,
  y = 0,
  xend = 1,
  yend = 1,
  alpha = 1,
  color = "black",
  linetype = "solid",
  size = 1.5,
  lineend = "butt",
  linejoin = "round",
  arrow = ggplo2::arrow(length = 0),
  arrow.fill = NULL
)

Arguments

x

numeric x position, defaults to 0

y

numeric y position, defaults to 0

xend

numeric x end position, defaults to 1

yend

numeric y end position, defaults to 1

alpha

numeric between 0 and 1 indicating transparency, defaults to 1 fully opaque, zero is fully transparent

color

a character string indicating color, defaults to "black", for other named colors check out https://evamaerey.github.io/ggplot2_grammar_guide/named_colors

linetype

a string indicating linetype, "solid", "dashed", "dotted", defaults to "solid"

size

numeric value indicating line width, defaults to 1.5

lineend

Line end style (round, butt, square)

arrow

specification for arrow heads, as created by arrow().

Value

Examples

# segment on plot space library(ggplot2) ggplot(cars) + aes(speed, dist) + geom_point() + stamp_segment(color = "darkred", xend = 15, yend = 75)
# segments on canvas ggcanvas() + stamp_segment(color = "green") + stamp_segment(x = 1:5, y = 2, xend = 2:6, size = 8, alpha = .5, lineend = "round")