# Question about the width argument for Gadfly violin plots

**URL:** <https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339>\
**Category:** Visualization\
**Tags:** question, plotting, gadfly, visualization\
**Created:** [September 15, 2022, 10:17pm UTC](https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339 "2022-09-15T22:17:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)\
**Post date:** [September 15, 2022, 10:17pm UTC](https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339/1 "2022-09-15T22:17:01Z")

</div>

Hi all,  
I am trying to adjust the scaling of violin plots from Gadfly. I am trying to play around with the “width” argument but I always get the following message

```julia
Warning: The following aesthetics are mapped, but not used by any geometry:
│ width

```

Here’s the code that I used to generate violin plots

```julia
ys = rand(1000)
width = ones(size(ys))
Gadfly.plot(y = ys, width = width , Geom.violin)

```

Can anyone help me understand what the width argument does? The documentation states:

```julia
Draw y versus width, optionally grouping categorically by x and coloring with color. Alternatively, if width is not supplied, the data in y will be transformed to a density estimate using Stat.violin

```

much thanks in advance!

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [September 16, 2022, 11:47am UTC](https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339/2 "2022-09-16T11:47:17Z")

</div>

that error message and the docstring are wrong. Geom.violin only uses the x, y, and color aesthetics (see [Gadfly.jl/violin.jl at master · GiovineItalia/Gadfly.jl · GitHub](https://github.com/GiovineItalia/Gadfly.jl/blob/master/src/geom/violin.jl#L16)), and then converts y into a density called width internally using a statistic (see [Gadfly.jl/statistics.jl at master · GiovineItalia/Gadfly.jl · GitHub](https://github.com/GiovineItalia/Gadfly.jl/blob/master/src/statistics.jl#L1674-L1729)).

what specifically are you trying to do?

---

<div class="post-metadata">

**Author:** ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)\
**Post date:** [September 21, 2022, 9:06pm UTC](https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339/3 "2022-09-21T21:06:16Z")

</div>

Thank you so much for clarifying the error message and docstring.

As for what I am trying to achieve:  
I was under the impression that the width of violin plots are automatically scaled depending on the range of densities being plotted. If this impression is correct, I was wondering if it is possible to control the ratio between probability density and the displayed violin plot width (“units” along the x-axis)? This would be helpful for comparing violin plots that are displayed in separate figures.

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [October 1, 2022, 12:31pm UTC](https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339/4 "2022-10-01T12:31:12Z")

</div>

maintaining the same width scale for violin plots is probably (i haven’t tried) done by [Geom.subplot\_grid](http://gadflyjl.org/stable/gallery/geometries/#Gallery_Geom.subplot_grid), but for two entirely independent plots i don’t believe that’s possible. would be a great feature to have though.

---

<div class="post-metadata">

**Author:** ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)\
**Post date:** [October 2, 2022, 2:56pm UTC](https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339/5 "2022-10-02T14:56:40Z")

</div>

I see, thanks. Do you happen to know some effective ways to request features for a julia package?

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [October 2, 2022, 3:07pm UTC](https://discourse.julialang.org/t/question-about-the-width-argument-for-gadfly-violin-plots/87339/6 "2022-10-02T15:07:04Z")

</div>

submit an issue on github. for gadfly that’d be [here](https://github.com/GiovineItalia/Gadfly.jl/issues)
