11import matplotlib.pyplot
as plt
15from ROOT
import TFile, gROOT
17mpl_fig = plt.figure(figsize=(14, 12))
18gs = mpl_fig.add_gridspec(3, 2, height_ratios=[1.5, 1.5, 1.5])
22example =
TFile(
"py-hsimple.root")
26hpx = gROOT.FindObject(
"hpx")
29entries =
int(hpx.GetEntries())
31std_dev = hpx.GetStdDev()
32info_text = f
"Entries = {entries}\nMean = {mean:.5f}\nStd Dev = {std_dev:.3f}"
34ax1 = mpl_fig.add_subplot(gs[0:2, 0])
35ax1.set_facecolor(
"#FFFDD0C8")
36hep.histplot(hpx, ax=ax1, histtype=
"fill", color=
"#EEAC91", alpha=0.5, edgecolor=
"blue", linewidth=1.5)
41 transform=ax1.transAxes,
42 verticalalignment=
"top",
44 bbox=dict(boxstyle=
"round,pad=0.3", facecolor=
"white", alpha=0.7),
48ax2 = mpl_fig.add_subplot(gs[0:2, 1], projection=
"3d")
49ax2.set_facecolor(
"#FFFDD0C8")
50x = np.array([hpx.GetBinCenter(i)
for i
in range(1, hpx.GetNbinsX() + 1)])
54dx = np.full_like(x, hpx.GetBinWidth(1) * 0.9)
55dy = np.full_like(x, 0.2)
56ax2.bar3d(x, y, z, dx, dy, dz, color=
"#EEAC91", edgecolor=
"darkblue", alpha=0.85)
61 transform=ax2.transAxes,
63 bbox=dict(boxstyle=
"round,pad=0.3", facecolor=
"white", alpha=0.7),
67ax3 = mpl_fig.add_subplot(gs[2, :])
68ax3.set_facecolor(
"#FFFDD0C8")
69hep.histplot(hpx, ax=ax3, histtype=
"errorbar", color=
"darkblue")
75 transform=ax3.transAxes,
76 verticalalignment=
"top",
78 bbox=dict(boxstyle=
"round,pad=0.3", facecolor=
"white", alpha=0.7),
81mpl_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 ...