Note
Go to the end to download the full example code.
Simple 1-D histogram#
Simple one-dimensional histogram filled with random numbers from a normal distribution.

<matplotlib.legend.Legend object at 0x7f9d37b7f0e0>
import numpy as np
from aptapy.hist import Histogram1d
from aptapy.plotting import plt
# Create and fill the histogram...
hist = Histogram1d(np.linspace(-5., 5., 100), label="Random data", xlabel="z")
hist.fill(np.random.default_rng().normal(size=100000))
# ...and plot it including the basic binned statistics in the legend.
hist.plot(statistics=True)
plt.legend()
Total running time of the script: (0 minutes 0.251 seconds)