Ribbon opacity when plotting multiple line in Plots.jl

I have some lines I’m plotting that I want to add error bars too. Here’s an approximation of my data, and my first attempt to plot these lines with error bars

s = 1:10:101 
r = 0.0:0.1:1 

rand_error=rand(5:10,(11,11))
N=20

rev = zeros(length(s), length(r))

for ps in 1:length(s)
    for pr in 1:length(r)
        A = 1 - ((N-1)/N)^s[ps]
        frac = (A*r[pr] - A) / (A*r[pr] - A - r[pr])
        rev[ps, pr] = 0.8*(frac*133 + (1 - frac)*100) + 20
    end

end
rev_2=permutedims(rev)

p1 = Plots.plot(r, rev_2, yerr=rand_error, msc=:auto, linewidth=2,label=permutedims(s), xlabel="R", ylabel="Mean value", legend= :outerright,palette=palette(:viridis,11,rev=true),legendtitle="s=")

Now, I didn’t really like how that looked, so I tried it with a ribbon:

p1 = Plots.plot(r, rev_2, ribbon=rand_error, linewidth=2,label=permutedims(s), xlabel="R", ylabel="Mean value", legend= :outerright,palette=palette(:viridis,11,rev=true),legendtitle="s=")

But this hides most of my lines! Is there any way to control the opacity of a ribbon like in R? Is this possible with Plots? Or only with some other package? Any tips would be appreciated!

Hello and welcome to the community :waving_hand:

Try fillalpha = 0.1, like this

p1 = Plots.plot(r, rev_2, ribbon=rand_error, linewidth=2,label=permutedims(s), xlabel="R", ylabel="Mean value", legend= :outerright,palette=palette(:viridis,11,rev=true),legendtitle="s=")

1 Like