# How to show all xlabels in violin plot

**URL:** https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627
**Category:** Visualization
**Tags:** statsplots
**Created:** [September 19, 2024, 10:38pm UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627 "2024-09-19T22:38:25Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [September 19, 2024, 10:38pm UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627/1 "2024-09-19T22:38:25Z")

</div>

Hi,

In the code below, only evenly indexed labels display. How do I show all xlabels?

Thanks!

```julia

using StatsPlots
x = randn(1000, 16)
labels = map(x -> randstring(3), 1:16)
violin(permutedims(labels), x, rotation = 90, leg = false)

```

---

<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: [September 20, 2024, 8:19am UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627/3 "2024-09-20T08:19:02Z")

</div>

You could also use the Plots’ keyword: `xticks=:all` on your original code.

---

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [September 21, 2024, 2:03pm UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627/4 "2024-09-21T14:03:50Z")

</div>

Thanks Rafael. I updated the solution above. Even when I figure out a solution, you find a better one 🙂.

---

<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: [September 21, 2024, 2:43pm UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627/5 "2024-09-21T14:43:07Z")

</div>

Hum… That was supposed to work with the code in your original post.

PS:  
`labels` are not used in your revised solution. Also, I am surprised that `:all` works as you wish in that snippet?

---

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [September 21, 2024, 8:08pm UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627/6 "2024-09-21T20:08:19Z")

</div>

Opps. You are correct. I posted the wrong syntax. Can you clarify the syntax with `:all`. The following does not work:

```julia
using StatsPlots
using Random

x = randn(1000, 16)
labels = map(x -> randstring(3), 1:16)
violin(x, xticks = (:all,labels), rotation = 90, leg = false)

```

---

<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: [September 21, 2024, 8:11pm UTC](https://discourse.julialang.org/t/how-to-show-all-xlabels-in-violin-plot/119627/7 "2024-09-21T20:11:29Z")

</div>

So, from the discussion above, I see two options:

```julia
using StatsPlots, Random

x = randn(1000, 16)
labels = map(x -> randstring(3), 1:16)

# OPTION-1
violin(permutedims(labels), x, xticks=:all, rotation=45, leg=false)

# OPTION-2
violin(x, xticks=(1:16, labels), rotation=45, leg=false)

```
