Plotting a distribution

Trying to plot normal distributions from the Distributions package. How do I do this?

julia> normalDist = fit(Normal, data)

Normal{Float64}(μ=100.3434334, σ=0.05)

julia> plot(normalDist)

ERROR: No user recipe defined for Normal{Float64}

Which plotting package is this? Try StatsPlots https://github.com/JuliaPlots/StatsPlots.jl/blob/master/README.md

Please quote your code.

It is unclear what you want to plot for a distribution. The pdf, the cdf, or something else? In any case, here is a PGFPlotsX example:

using PGFPlotsX, Distributions

d = Normal(100.3434334, 0.05)
lo, hi = quantile.(d, [0.01, 0.99])
x = range(lo, hi; length = 100)
@pgf Axis({ xlabel = "x", ylabel = "pdf" },
          Plot({thick, blue }, Table(x, pdf.(d, x))))
@pgf Axis({ xlabel = "x", ylabel = "cdf" },
          Plot({thick, blue }, Table(x, cdf.(d, x))))

1 Like

Thank You! StatsPlots works as expected. I was trying the standard Plots package.