# AlgebraOfGraphics and transparency

**URL:** https://discourse.julialang.org/t/algebraofgraphics-and-transparency/134032
**Category:** New to Julia
**Tags:** plotting, algebraofgraphics
**Created:** [November 21, 2025, 4:06pm UTC](https://discourse.julialang.org/t/algebraofgraphics-and-transparency/134032 "2025-11-21T16:06:55Z")
**Posts on this page:** 3
**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: [November 21, 2025, 4:06pm UTC](https://discourse.julialang.org/t/algebraofgraphics-and-transparency/134032/1 "2025-11-21T16:06:55Z")

</div>

Hi! Can I use AlgebraOfGraphics to create a violin plot, overlay a boxplot with some transparency and also to be able to see all the dots?

Thanks for your help!

---

<div class="post-metadata">

### Author: ![souma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/souma/32/212836_2.png) [@souma](https://discourse.julialang.org/u/souma)
#### Post date: [November 21, 2025, 7:43pm UTC](https://discourse.julialang.org/t/algebraofgraphics-and-transparency/134032/2 "2025-11-21T19:43:30Z")

</div>

So I’ll walk through how I found the info and I’ll give a rough shell on a solution . I don’t have the ability to test it right now, so my solution won’t be copy paste workable, and there may be better solutions, but here is one. AlgebraOfGraphics has a tutorial set. In the [first one](https://aog.makie.org/stable/tutorials/intro-i) there is a section called “stacking layers with +”. There is also “Attributes of visual” that links to the Makie documentation describing the attributes available for its different plotting sections. From that we can say you want the `Violin` `Scatter` and `Boxplot` visuals.

I looked at the boxplot documentation for transparency stuff and there was no “alpha” or “transparency” attribute. I just looked up “Makie.jl transparent fill boxplot” and got [this page](https://docs.makie.org/stable/explanations/transparency.html). This seems to say that you can use RGBA colors. So if you create a set of RGB colors, you can then set your mapping variable to those, and then when you create the boxplot layer, you can do some sort of mapping from your color variable to RGBA with a set alpha.

So you’ll have something like this

```julia

m = data(df) * mapping(:x,:y, color=:csvar)
violinp = m * visual(Violin)

boxplotp = m * mapping(:x, :y, color= :csvar => (c -> RGBA(c,0.4))) *visual(Boxplot)

scatterp = m * visual(Scatter)
draw(violinp + boxplotp + scatterp)

```

There are jittering/beeswarm ways of performing the scatterplot if you want.

The data viz person in me also has to cordially ask, do you need the boxplot, and does the violin tell a violin specific story? Or could just a beeswarm show the same info? That could make this plotting solution much simpler (one simple layer rather than three, potentially complicated layers). But it’s not my place to assert plotting decisions, we don’t need to discuss this point more, I just wanted to float the idea.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [November 21, 2025, 9:08pm UTC](https://discourse.julialang.org/t/algebraofgraphics-and-transparency/134032/3 "2025-11-21T21:08:50Z")

</div>

Yeah in principle that would be just three visuals like `visual(Violin) + visual(Boxplot, alpha = 0.5) + visual(Beeswarm, algorithm = :quasirandom)` with Beeswarm from the 0.2 branch of SwarmMakie.jl (not merged and released, yet).

But I also think I recently noticed box plot doesn’t respect alpha, yet, so that might need fixing first
