Gadfly: How to change width and opacity of lines in Geom.density?

I tried Theme(alphas = [0.3], line_width=10cm), but it didn’t work.

Setting the line width like that should work. Try using style in the plot command? For transparency, I’m not sure what the alphas option does. You could try setting the line color to something with transparency, like so:

julia> x = rand(10)
julia> using Colors
julia> plot(x = x, Geom.density, style(line_width=3mm, default_color = RGBA(.1, .1, .9, .3)))

You’re right, this works. My problem was with layering, it seems. Still, it’s weird why setting the alpha this way doesn’t work:

p = plot(
        x = g1,
        Geom.density(bandwidth = 1),
        color = [RGBA(1, 0, 0, 0.3)], # ALPHA ignored
        x = v1,
        Geom.density(bandwidth = 1),
         color = [RGB(0, 1, 0)],

Theme(alphas= ) is the alpha palette for the alpha aesthetic and Scale.alpha_discrete (see Gadfly Tutorial). alpha and color are separate aesthetics, which is why a is ignored in color=[RGBA(r,g,b,a)].
Currently, the alpha aesthetic been enabled for Geom.point, Geom.polygon, and Geom.ribbon, but not Geom.line.

There is also Theme(lowlight_color= ), which is old pre-alpha code. This was enabled for Geom.polygon and Geom.ribbon and controls stroke color (fill=false) or fill color (fill=true). It must be a function, e.g.

using Colors
gp = Geom.polygon(preserve_order=true)
p = plot(x=rand(20), Stat.density, gp,
#    Theme(lowlight_color=x->"gray", line_width=3pt)
    Theme(lowlight_color=x->RGBA(x,0.3), line_width=3pt)

More examples of Stat.density and Scale.alpha_.