from pyhs3.data import BinnedData
from pyhs3.axes import BinnedAxis

# Create binned data with variable-width bins
data = BinnedData(
    name="variable_bins",
    type="binned",
    contents=[5.0, 15.0, 8.0],
    axes=[BinnedAxis(name="pt", edges=[0.0, 10.0, 50.0, 100.0])]
)

# Convert to hist and plot
h = data.to_hist()
h.plot(histtype="step", linewidth=2, label="pT distribution")
plt.xlabel("pT [GeV]")
plt.ylabel("Events")
plt.legend()
plt.title("Variable-Width Bins")