Only Efficiency

1D Comparison Efficiency

Imports
import hist
import matplotlib.pyplot as plt
import numpy as np

import mplhep as mh

np.random.seed(42)
Setup
# Generate dummy data - sample is subset of total
x_total = np.random.normal(0.4, 0.1, 10000)
x_sample = x_total[:7500]  # 75% subset

# Create and fill histograms
h_sample = hist.new.Regular(50, 0, 1).Weight().fill(x_sample)
h_total = hist.new.Regular(50, 0, 1).Weight().fill(x_total)

Code

fig, ax = plt.subplots()
mh.comp.comparison(h_sample, h_total, ax=ax, xlabel="Variable", comparison="efficiency")
Full code
import hist
import matplotlib.pyplot as plt
import numpy as np

import mplhep as mh

np.random.seed(42)

# Generate dummy data - sample is subset of total
x_total = np.random.normal(0.4, 0.1, 10000)
x_sample = x_total[:7500]  # 75% subset

# Create and fill histograms
h_sample = hist.new.Regular(50, 0, 1).Weight().fill(x_sample)
h_total = hist.new.Regular(50, 0, 1).Weight().fill(x_total)

fig, ax = plt.subplots()
mh.comp.comparison(h_sample, h_total, ax=ax, xlabel="Variable", comparison="efficiency")