13import matplotlib.pyplot
as plt
17from ROOT
import TFile, gROOT
19mpl_fig = plt.figure(figsize=(14, 12))
20gs = mpl_fig.add_gridspec(3, 2, height_ratios=[1.5, 1.5, 1.5])
24example =
TFile(
"py-hsimple.root")
28hpx = gROOT.FindObject(
"hpx")
31entries =
int(hpx.GetEntries())
33std_dev = hpx.GetStdDev()
34info_text = f
"Entries = {entries}\nMean = {mean:.5f}\nStd Dev = {std_dev:.3f}"
36ax1 = mpl_fig.add_subplot(gs[0:2, 0])
37ax1.set_facecolor(
"#FFFDD0C8")
38hep.histplot(hpx, ax=ax1, histtype=
"fill", color=
"#EEAC91", alpha=0.5, edgecolor=
"blue", linewidth=1.5)
43 transform=ax1.transAxes,
44 verticalalignment=
"top",
46 bbox=dict(boxstyle=
"round,pad=0.3", facecolor=
"white", alpha=0.7),
50ax2 = mpl_fig.add_subplot(gs[0:2, 1], projection=
"3d")
51ax2.set_facecolor(
"#FFFDD0C8")
52x = np.array([hpx.GetBinCenter(i)
for i
in range(1, hpx.GetNbinsX() + 1)])
56dx = np.full_like(x, hpx.GetBinWidth(1) * 0.9)
57dy = np.full_like(x, 0.2)
58ax2.bar3d(x, y, z, dx, dy, dz, color=
"#EEAC91", edgecolor=
"darkblue", alpha=0.85)
63 transform=ax2.transAxes,
65 bbox=dict(boxstyle=
"round,pad=0.3", facecolor=
"white", alpha=0.7),
69ax3 = mpl_fig.add_subplot(gs[2, :])
70ax3.set_facecolor(
"#FFFDD0C8")
71hep.histplot(hpx, ax=ax3, histtype=
"errorbar", color=
"darkblue")
77 transform=ax3.transAxes,
78 verticalalignment=
"top",
80 bbox=dict(boxstyle=
"round,pad=0.3", facecolor=
"white", alpha=0.7),
83mpl_fig.suptitle(
"Drawing options for one dimensional histograms", fontsize=14, fontweight=
"bold")
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...