var1d(x, bins, weights=None, density=False, flow=False, cons_var=False)¶
Histogram data with variable bin widths.
x (numpy.ndarray) – Data to histogram
bins (numpy.ndarray) – Bin edges
weights (numpy.ndarray, optional) – The weights for each element of x. If weights are absent, the second return type will be
density (bool) – Normalize histogram counts as value of PDF such that the integral over the range is unity.
flow (bool) – Include under/overflow in the first/last bins.
cons_var (bool) – If
True, conserve the variance rather than return the standard error (square root of the variance).
A simple histogram with variable width bins:
>>> rng = np.random.default_rng(123) >>> x = rng.standard_normal(1000) >>> edges = np.array([-3.0, -2.5, -1.5, -0.25, 0.25, 2.0, 3.0]) >>> h, __ = var1d(x, edges)