# How to adjust the X-axis order of boxplot with StatsPlots.jl

**URL:** https://discourse.julialang.org/t/how-to-adjust-the-x-axis-order-of-boxplot-with-statsplots-jl/56065
**Category:** Visualization
**Tags:** plots, statsplots
**Created:** [February 26, 2021, 5:12am UTC](https://discourse.julialang.org/t/how-to-adjust-the-x-axis-order-of-boxplot-with-statsplots-jl/56065 "2021-02-26T05:12:56Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)
#### Post date: [February 27, 2021, 3:30am UTC](https://discourse.julialang.org/t/how-to-adjust-the-x-axis-order-of-boxplot-with-statsplots-jl/56065/9 "2021-02-27T03:30:04Z")

</div>

> [@mkborregaard](#):
>
> What syntax would you suggest for that?

Hi, @mkborregaard, I have no knowledge of internal details. But how about

```julia
@df df boxplot(string.(:id), :value, fillalpha=0.75, linewidth=1, xorder=[3, 17, 21])

```

Or we may pass into a custom `sort` function to sort the specific column in a `df`.

```julia
@df df boxplot(string.(:id), :value, fillalpha=0.75, linewidth=1, 
                         xsort=sort)

```

The above two `lpad` and `sprintf` workarounds work well for this particular example. But what if I want the order to be `21 3 17`? Of course, I can still find a workaround, but it does not look beautiful.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-adjust-the-x-axis-order-of-boxplot-with-statsplots-jl/56065)._
