Learn R Programming

kim (version 0.5.3)

bracket: Draw a bracket on a ggplot

Description

Draw a square bracket with a label on a ggplot

Usage

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
)

Value

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

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

Examples

Run this code
# \donttest{
prep(ggplot2)
ggplot(mtcars, aes(x = cyl, y = mpg)) + geom_point() +
bracket(6.1, 6.2, 17, 22, bracket_shape = "]", label = "abc")
# }

Run the code above in your browser using DataLab