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(
layer(
x = g1,
Geom.density(bandwidth = 1),
color = [RGBA(1, 0, 0, 0.3)], # ALPHA ignored
style(line_width=2mm,
),
),
layer(
x = v1,
Geom.density(bandwidth = 1),
color = [RGB(0, 1, 0)],
style(line_width=2mm),
),
);
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_
.
Like this:
x = [25:55;]
n = 30
ys = [exp.([ones(length(x)) x]*rand(b)) for _ in 1:n]
plot(layer(D, x=:x, y=:y, Geom.point, color=[colorant"orange"], size=[4pt]),
layer(ys, x=repeat(x, outer=n), y=Col.value, Geom.line, group=Col.index,
Theme(default_color=RGBA(0,0,0,0.1), line_width=3pt)),
Coord.cartesian(xmin=25, xmax=55))