Question about the width argument for Gadfly violin plots

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

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

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

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:

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!

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), and then converts y into a density called width internally using a statistic (see Gadfly.jl/statistics.jl at master · GiovineItalia/Gadfly.jl · GitHub).

what specifically are you trying to do?

1 Like

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.

maintaining the same width scale for violin plots is probably (i haven’t tried) done by Geom.subplot_grid, but for two entirely independent plots i don’t believe that’s possible. would be a great feature to have though.

1 Like

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

submit an issue on github. for gadfly that’d be here

1 Like