bracket function

Draw a bracket on a ggplot

Draw a bracket on a ggplot

Draw a square bracket with a label on a ggplot

bracket( xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, vertical = NULL, horizontal = NULL, open = NULL, bracket_shape = NULL, thickness = 2, bracket_color = "black", label = NULL, label_hjust = NULL, label_vjust = NULL, label_font_size = 5, label_font_face = "bold", label_color = "black", label_parse = FALSE )

Arguments

  • xmin: xmin
  • xmax: xmax
  • ymin: ymin
  • ymax: ymax
  • vertical: vertical
  • horizontal: horizontal
  • open: open
  • bracket_shape: bracket_shape
  • thickness: thickness
  • bracket_color: bracket_color
  • label: label
  • label_hjust: label_hjust
  • label_vjust: label_vjust
  • label_font_size: label_font_size
  • label_font_face: label_font_face
  • label_color: label_font_face
  • label_parse: label_parse

Returns

a ggplot object; there will be no meaningful output from this function. Instead, this function should be used with another ggplot object

Examples

library(ggplot2) ggplot(mtcars, aes(x = cyl, y = mpg)) + geom_point() + bracket(6.1, 6.2, 17, 22, bracket_shape = "]", label = "abc")