# NOT RUN {
set.seed(123)
library(ggplot2)
# plot
p <- ggplot(iris, aes(Species, Sepal.Length)) +
  geom_boxplot()
# dataframe with pairwise comparison test results
df_pair <-
  pairwiseComparisons::pairwise_comparisons(
    data = iris,
    x = Species,
    y = Sepal.Length
  )
# adding a geom for pairwise comparisons
ggstatsplot:::ggsignif_adder(
  plot = p,
  data = iris,
  x = Species,
  y = Sepal.Length,
  df_pairwise = df_pair
)
# }
Run the code above in your browser using DataLab