This function adds a text annotation layer

stamp_curve(
  x = 0,
  y = 0,
  xend = 1,
  yend = 1,
  alpha = 1,
  color = "black",
  linetype = "solid",
  size = 1.5,
  lineend = "butt",
  curvature = 0.1,
  curveangle = 90,
  ncp = 5
)

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)

curvature

A numeric value giving the amount of curvature. Negative values produce left-hand curves, positive values produce right-hand curves, and zero produces a straight line, defaults to .1

curveangle

A numeric value between 0 and 180, giving an amount to skew the control points of the curve. Values less than 90 skew the curve towards the start point and values greater than 90 skew the curve towards the end point.

ncp

The number of control points used to draw the curve. More control points creates a smoother curve, default is 5

arrow

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

Value

Examples

# a curve library(ggplot2) ggplot(cars) + aes(speed, dist) + geom_point() + stamp_curve(color = "darkred", xend = 15, yend = 75)
# more curves ggcanvas() + stamp_curve() + stamp_curve(color = "green") + stamp_curve(x = 1:5, yend = 2, xend = 2:6, size = 8, alpha = .5) + stamp_point(x = 1:5, y = 0)