# Categorical histogram

**URL:** <https://discourse.julialang.org/t/categorical-histogram/76323>\
**Category:** General Usage\
**Tags:** statsplots, histogram\
**Created:** [February 13, 2022, 12:32am UTC](https://discourse.julialang.org/t/categorical-histogram/76323 "2022-02-13T00:32:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliauser](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Post date:** [February 13, 2022, 12:32am UTC](https://discourse.julialang.org/t/categorical-histogram/76323/1 "2022-02-13T00:32:19Z")

</div>

How can I set the order of the groups? Julia tends to reshuffle them randomly. And how can I add a second row with a bracket and its own name to show that G1 and G2 are part of a subgroup called Gprime?

```julia
ctg = repeat(["Category 1", "Category 2"], inner = 5)
nam = repeat("G" .* string.(1:5), outer = 2)

groupedbar(nam, rand(5, 2), group = ctg, xlabel = "Groups", ylabel = "Scores",
        title = "Scores by group and category", bar_width = 0.67,
        lw = 0, framestyle = :box)

```
