using FHist, Statistics, Plots

Hist1D

Let's generate three dummy histograms sampled from three different distributions:

  1. unit Gaussian with 1000 points

  2. unit Gaussian with 10000 points

  3. unit Gaussians with 1000 points and a mean of 0.5

begin
    h1 = Hist1D(randn(10^3); binedges = -2:0.3:2)
    h2 = Hist1D(randn(10^4); binedges = -2:0.3:2)
    h3 = Hist1D(randn(10^3) .+ 0.5; binedges = -2:0.3:2)
end
-2.01.9
  • edges: [-2.0, -1.7, -1.4, -1.1, -0.8, -0.5, -0.2, 0.1, 0.4, 0.7, 1.0, 1.3, 1.6, 1.9]
  • bin counts: [11.0, 11.0, 24.0, 39.0, 60.0, 74.0, 90.0, 117.0, 124.0, 128.0, 103.0, 81.0, 42.0]
  • maximum count: 128.0
  • total count: 904.0
begin
    Plots.plot(h1; size=(600, 500), legend=:topleft)
    Plots.plot!(h3)
end

Hist2D

begin
        h2d = Hist2D((randn(10000), randn(10000)))
        p2d = plot(h2d)
end