pygram11.var1d

pygram11.var1d(x, bins, weights=None, density=False, flow=False)[source]

Histogram data with variable bin widths.

Parameters
  • x (array_like) – data to histogram

  • bins (array_like) – bin edges

  • weights (array_like, optional) – weight for each element of x

  • density (bool) – normalize histogram bins as value of PDF such that the integral over the range is 1.

  • flow (bool) – if True the under and overflow bin contents are added to the first and last bins, respectively

Returns

Examples

A simple histogram with variable width bins:

>>> x = np.random.randn(10000)
>>> bin_edges = [-3.0, -2.5, -1.5, -0.25, 0.25, 2.0, 3.0]
>>> h, __ = var1d(x, bin_edges)