To compare the pdfs and to convey the right information on the normal distribution, each normal pdf of mean \mu =0, and standard deviation, σ ∈ 0.5:0.25:4.0, should be represented on the interval (-3σ, 3σ), because if X \sim N(0, σ), then the probability, P(-3σ < X < 3\sigma)=\Phi(3)-\Phi(-3)=2\Phi(3)-1=0.99, where \Phi is the cdf of N(0,1). Indeed:
julia> using Distributions
julia> d = Normal(0,1);
julia> prob=2*cdf(d, 3)-1
0.9973002039367398
Then the graphs look as follows:
using PlotlyJS, Colors, ColorSchemes
f(x, σ; μ=0)= exp(-0.5*(x-μ)^2/σ^2)/(σ*sqrt(2π))
fig=Plot();
sigmas=0.5:0.25:4.0
n=length(sigmas)
mycolors = ColorScheme([get(ColorSchemes.turbo, t) for t in range(0, 1.0, length=n)])
for (k,σ) ∈ enumerate(sigmas)
x= range(-3*σ, 3*σ, length=floor(Int,100*σ))
addtraces!(fig, scatter3d(x=x, y=σ*ones(size(x)), z=f.(x, σ),
mode="lines", name="σ: $σ",
line_color="#"*hex(mycolors[k]), line_width=4))
end
relayout!(fig, width=500, height=500, #template=templates["plotly_dark"],
scene_xaxis_range=[-3*sigmas[end], 3*sigmas[end]],
scene_camera_eye=attr(x=1.5, y=1.5, z=0.7), font_size=11,
)
display(fig)
or as surfaces: