# X-axis labels for histograms and violins

**URL:** https://discourse.julialang.org/t/x-axis-labels-for-histograms-and-violins/24160
**Category:** Visualization
**Created:** [May 13, 2019, 4:35am UTC](https://discourse.julialang.org/t/x-axis-labels-for-histograms-and-violins/24160 "2019-05-13T04:35:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rakeshvar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakeshvar/32/3613_2.png) [@rakeshvar](https://discourse.julialang.org/u/rakeshvar)
#### Post date: [May 13, 2019, 4:35am UTC](https://discourse.julialang.org/t/x-axis-labels-for-histograms-and-violins/24160/1 "2019-05-13T04:35:49Z")

</div>

I have three classes that I want to visualize as a violin plot. I have data as an array or arrays. And names as an array of strings. I want the names to be shown on the x-axis.

```julia
using StatPlots
gr()
x = [rand(9) for i in 1:3]
lbls = [randstring(2) for i in 1:3]
violin(lbls, x)

```

This does not seem to work.

```julia
violin(x, labels=lbls)

```

This puts the labels in a legend, but I want it to be along the x-axis. How do I do this without invoking DataFrames, or even with invoking them, but I have many more than three classes of data. Thanks.

---

<div class="post-metadata">

### Author: ![rakeshvar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakeshvar/32/3613_2.png) [@rakeshvar](https://discourse.julialang.org/u/rakeshvar)
#### Post date: [May 13, 2019, 4:41am UTC](https://discourse.julialang.org/t/x-axis-labels-for-histograms-and-violins/24160/2 "2019-05-13T04:41:09Z")

</div>

Figured it out. The labels need to be a row vector! However

```julia
lbls = [randstring(2) for i in 1:3]'

```

does not work in 0.6 😬  
But that does not relate to plots.

---

<div class="post-metadata">

### Author: ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)
#### Post date: [May 13, 2019, 5:54am UTC](https://discourse.julialang.org/t/x-axis-labels-for-histograms-and-violins/24160/3 "2019-05-13T05:54:58Z")

</div>

Yes - people felt that transposing should be disallowed for non-numeric matrices. You can use `permutedims` instead.
