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 )
xmin
: xminxmax
: xmaxymin
: yminymax
: ymaxvertical
: verticalhorizontal
: horizontalopen
: openbracket_shape
: bracket_shapethickness
: thicknessbracket_color
: bracket_colorlabel
: labellabel_hjust
: label_hjustlabel_vjust
: label_vjustlabel_font_size
: label_font_sizelabel_font_face
: label_font_facelabel_color
: label_font_facelabel_parse
: label_parsea ggplot object; there will be no meaningful output from this function. Instead, this function should be used with another ggplot object
library(ggplot2) ggplot(mtcars, aes(x = cyl, y = mpg)) + geom_point() + bracket(6.1, 6.2, 17, 22, bracket_shape = "]", label = "abc")
Useful links