# Wind Rose 'hard' stacked barplot edges in GLMakie

**URL:** https://discourse.julialang.org/t/wind-rose-hard-stacked-barplot-edges-in-glmakie/124277
**Category:** Visualization
**Tags:** makie, glmakie
**Created:** [December 30, 2024, 3:42pm UTC](https://discourse.julialang.org/t/wind-rose-hard-stacked-barplot-edges-in-glmakie/124277 "2024-12-30T15:42:45Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)
#### Post date: [December 30, 2024, 11:39pm UTC](https://discourse.julialang.org/t/wind-rose-hard-stacked-barplot-edges-in-glmakie/124277/2 "2024-12-30T23:39:30Z")

</div>

There isn’t a simple way to get that yet. Somewhere between the barplot and the Polar transform applying, the Rect2f’s barplot generates need to get interpolated. You can hack Makie to do that like this:

```julia
tbl = (cat = [1, 1, 1, 2, 2, 2, 3, 3, 3],
       height = 0.1:0.1:0.9,
       grp1 = [1, 2, 2, 1, 1, 2, 1, 1, 2],
       grp2 = [1, 1, 2, 1, 2, 1, 1, 2, 1]
       );

f = Figure(width=200, height=200);

ax = PolarAxis(f[1, 1],
    rticks=1:0.1:1,
    );

p = barplot!(ax,
    tbl.cat, 
    tbl.height,
    stack = tbl.grp1,
    color = tbl.grp2,
    colormap=:lightrainbow,
);
pp = popat!(p.plots, findfirst(x -> x isa Poly, p.plots))
polys = map(pp.converted[1]) do rects
    map(rects) do rect
        N_steps = 100
        mini = minimum(rect); maxi = maximum(rect)
        ps = Point2f[mini, Point2f(mini[1], maxi[2]), maxi, Point2f(maxi[1], mini[2]), mini]
        ps = map(range(0, 4, length = N_steps)) do f
            ps[1] * max(0, 1-f) + 
            ps[2] * max(0, 1 - abs(f-1)) + 
            ps[3] * max(0, 1 - abs(f-2)) + 
            ps[4] * max(0, 1 - abs(f-3)) + 
            ps[5] * max(0, 1 - abs(f-4))
        end
        Makie.Polygon(ps)
    end
end
poly!(p, pp.attributes, polys)

f

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/4/e4c3fe61587bcecd519173edd3f12004cbb51138.png)

This will fail if you display before the poly!() call. Also worth an issue I think

---

_[View the full topic](https://discourse.julialang.org/t/wind-rose-hard-stacked-barplot-edges-in-glmakie/124277)._
