How to plot mean +/- deviation in Plots.jl?

question
plotting

#1

Consider the example below:

using Plots

xs = linspace(1,100)
μs = log.(xs)
σs = rand(length(xs))

plot(xs,μs,grid=false,yerror=σs)

Is there any way to replace the error bars by a shaded transparent area with the same color as the mean or lighter?

Something like what we usually have in Gaussian Processes illustrations, but relating the color of the shaded area to the mean:


#2

:ribbon
For some functions you could also check groupapply in StatPlots


#3

To get the ribbon in a specific color but ‘lighter’, use the same color but set fillalpha to less than 1.


#4

Thanks @mkborregaard, where do I pass :ribbon in the plot command?

Can you share a working example based on the one I started?


#5

For future reference, this is the solution:

using Plots

xs = linspace(1,100)
μs = log.(xs)
σs = rand(length(xs))

plot(xs,μs,grid=false,ribbon=σs,fillalpha=.5)

Thank you @mkborregaard.


#6

Is it possible to plot an “error” that asymmetric around the “mean”? That is, I want to plot the ribbon around the line f(x) with the error interval [f(x) - err1(x), f(x) + err2(x)], where err1(x) != err2(x).


#7

ribbon = (err1(x), err2(x))