Plotting of PDF of distributions not returning correct plot

You essentially have

plot(array)

In that case the xaxis is the index number into the array. You need something like plot(xarray, yarray), i.e.

x = collect(-2.0:0.1:2.0)
plot(x, pdf.(dist, x))

Alternatively you can plot a function in a range with Plots.jl via

pdf_eval(x) = pdf(dist, x)
plot(pdf_eval, -2, 2)

#equivalently
plot(x->pdf(dist,x), -2, 2)
2 Likes