Shade area under the curve between two points in Plots.jl

Hi all,

I was wondering if it is possible to shade the area under the curve in Plots.jl? For example, can I adapt the code below to shade the area between -1 and 1?

Thanks!

using Plots, Distributions

x = range(-3, 3, length=100)

y = pdf.(Normal(0,1), x)

plot(x, y, grid=false)
ix = abs.(x) .< 1
plot(x[ix], y[ix], fillrange = zero(x[ix]), fc=:blues)
plot!(x, y, grid=false, lc=:black, widen=false)

1 Like

I feel like I owe you a beer at this point. Thanks!

1 Like

We should buy a round of drinks to the creators of Plots.jl

2 Likes