# Disabling grouping along x-axis in grouped boxplot

**URL:** <https://discourse.julialang.org/t/disabling-grouping-along-x-axis-in-grouped-boxplot/93997>\
**Category:** Visualization\
**Tags:** statsplots\
**Created:** [February 3, 2023, 3:54pm UTC](https://discourse.julialang.org/t/disabling-grouping-along-x-axis-in-grouped-boxplot/93997 "2023-02-03T15:54:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jewh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jewh/32/28586_2.png) [@jewh](https://discourse.julialang.org/u/jewh)\
**Post date:** [February 3, 2023, 3:54pm UTC](https://discourse.julialang.org/t/disabling-grouping-along-x-axis-in-grouped-boxplot/93997/1 "2023-02-03T15:54:46Z")

</div>

Using the `group` keyword argument in `Statsplots.boxplot` adjusts the distance between individual boxes so that they cluster with their groups (see example below):

```julia
using StatsPlots

x = Vector{String}(undef, 40)

for i = 1:40
    if i % 4 == 0
        x[i] = "E"
    elseif i % 4 == 1
        x[i] = "A"
    elseif i % 4 == 2
        x[i] = "B"
    elseif i % 4 == 3
        x[i] = "C"
    end
end    

is_vowel(x) = x == "A" || x == "E" ? "vowel" : "consonant" 

boxplot(x, rand(40), group=is_vowel.(x))

```

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

Any idea how to disable this behaviour? In my use-case I have three boxes, but want to colour each according to one of two groups - 2 in one, 1 in the other. This asymmetry in distance between boxes makes the plot look really ugly.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 3, 2023, 10:59pm UTC](https://discourse.julialang.org/t/disabling-grouping-along-x-axis-in-grouped-boxplot/93997/2 "2023-02-03T22:59:29Z")

</div>

Maybe you could submit an issue in [StatsPlots.jl](https://github.com/JuliaPlots/StatsPlots.jl) to see if an additional argument could be added to the groupedboxplot recipe, where the spacing is [defined here](https://github.com/JuliaPlots/StatsPlots.jl/blob/98c4c215cdd581a2d3fb6b3125e9ee48ee4cf355/src/boxplot.jl#LL238C2-L238C2).
