Draw a 1D histogram to a canvas.
- Note
- When using graphics inside a ROOT macro the objects must be created with
new
.
␑␅,␁
import mplhep as hep
import numpy as np
import ROOT
rangeMin = 0.0
rangeMax = 10.0
sqroot =
ROOT.TF1(
"sqroot",
"x*gaus(0) + [3]*form1", rangeMin, rangeMax)
nBins = 200
h1d =
ROOT.TH1D(
"h1d",
"Test random numbers", nBins, rangeMin, rangeMax)
plt.text(5, 40,
"The sqroot function", fontsize=18, weight=
"bold", bbox=dict(facecolor=
"white", edgecolor=
"black"))
hep.histplot(h1d, yerr=
False, histtype=
"fill", color=
"brown", alpha=0.7, edgecolor=
"blue", linewidth=1)
stats_text = (
f"Entries = {len(random_numbers)}\nMean = {(np.mean(random_numbers)):.3f}\nStd Dev = {(np.std(random_numbers)):.2f}"
)
plt.text(0.90, 0.90, stats_text, transform=
plt.gca().transAxes, ha=
"right", va=
"top", bbox=dict(facecolor=
"white"))
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
- Date
- July 2025
- Author
- Rene Brun, Giacomo Parolini, Nursena Bitirgen
Definition in file hist003_TH1_draw_uhi.py.