# Adding significance to boxplots and violin plots

**URL:** <https://discourse.julialang.org/t/adding-significance-to-boxplots-and-violin-plots/135398>\
**Category:** New to Julia\
**Tags:** plotting, algebraofgraphics\
**Created:** [February 2, 2026, 6:54am UTC](https://discourse.julialang.org/t/adding-significance-to-boxplots-and-violin-plots/135398 "2026-02-02T06:54:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahmah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahmah/32/214326_2.png) [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Post date:** [February 2, 2026, 6:54am UTC](https://discourse.julialang.org/t/adding-significance-to-boxplots-and-violin-plots/135398/1 "2026-02-02T06:54:14Z")

</div>

I’m having the same question as [here](https://discourse.julialang.org/t/show-significance-on-boxplots/77365), but for Algebra of Graphics.

How can I add significance stars to boxplots?

Thanks!

---

<div class="post-metadata">

**Author:** ![eteppo](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@eteppo](https://discourse.julialang.org/u/eteppo)\
**Post date:** [February 2, 2026, 9:53am UTC](https://discourse.julialang.org/t/adding-significance-to-boxplots-and-violin-plots/135398/2 "2026-02-02T09:53:24Z")

</div>

After you call `draw`, you could modify the figure (global) with lower-level Makie. Mostly from LLM but appeared to work:

```julia-auto
using CairoMakie, AlgebraOfGraphics
dataset = (
    group = repeat(["A", "B", "C"], inner=20),
    value = [randn(20) .+ 5; randn(20) .+ 6; randn(20) .+ 7]
)
function add_signif!(x, y, text)
    lines!([x[1], x[1], x[2], x[2]], [y-0.2, y, y, y-0.2], color=:black)
    text!((x[1] + x[2]) / 2, y, text=text, align=(:center, :bottom))
end
function plot_boxplots(d, x, y)
    spec = data(d) * mapping(x, y) * visual(BoxPlot)
    draw(spec)
    add_signif!((2,3), maximum(d[y])+1, "***")
    return current_figure()
end
plot_boxplots(dataset, :group, :value)

```
