# \donttest{
library(ggplot2)
data <- data.frame(x = 1:10, y = 1:10, group = rep(c("A", "B"), each = 5))
labels <- c("A", "B")
colors <- c("A" = "red", "B" = "blue")
comparisons <- add_bracket_comparisons(groups1 = "A", groups2 = "B", labels = "*")
p <- ggplot(data, aes(x, y, color = group)) +
geom_point() +
legend_bracket(labels, colors, comparisons,
position = "topleft", output_width = 6, output_height = 4)
ggsave_vbracket(file.path(tempdir(), "plot.pdf"), p, width = 6, height = 4)
# }
Run the code above in your browser using DataLab