This function adds a text annotation layer

stamp_rect(
  xmin = -1,
  ymin = -1,
  xmax = 1,
  ymax = 1,
  x = 0,
  y = 0,
  alpha = 1,
  color = "black",
  fill = "grey85",
  linetype = "solid",
  size = 0.5,
  xxyy = NULL
)

Arguments

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

fill

a character string indicating fill color, defaults to "grey35", 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

Value

Examples

# rect library(ggplot2) ggplot(cars) + aes(speed, dist) + geom_point() + stamp_rect(color = "red") + stamp_rect( xxyy = data.frame(xmin = 1:4*3, xmax = 2:5*3, ymin = 1:4*6, ymax = 1:8*6))
#> Warning: Ignoring unknown aesthetics: x, y
#> Warning: Ignoring unknown aesthetics: x, y
# on a canvas ggcanvas() + stamp_rect(fill = "green") + stamp_rect(alpha = .8, fill = "steelblue", size = 0, xmin = 2, xmax = 3, ymin = 5, ymax = 8) + coord_equal()
#> Warning: Ignoring unknown aesthetics: x, y
#> Warning: Ignoring unknown aesthetics: x, y
#> Coordinate system already present. Adding new coordinate system, which will replace the existing one.