# pygram11.var2d#

pygram11.var2d(x, y, xbins, ybins, weights=None, flow=False, cons_var=False)[source]#

Histogram two dimensional data with variable width binning.

The two input arrays (x and y) must be the same length (shape).

Parameters
• x (numpy.ndarray) – First entries in data pairs to histogram.

• y (numpy.ndarray) – Second entries in data pairs to histogram.

• xbins (numpy.ndarray) – Bin edges for the x dimension.

• ybins (np.ndarray) – Bin edges for the y dimension.

• weights (array_like, optional) – The weights for data element. If weights are absent, the second return type will be None.

• flow (bool) – Include under/overflow.

• cons_var (bool) – If True, conserve the variance rather than return the standard error (square root of the variance).

Raises
• ValueError – If x and y have different shape.

• ValueError – If either bin edge definition is not monotonically increasing.

• TypeError – If x, y, or weights are unsupported types

Returns

Examples

A histogram of (x, y) where the edges are defined by a numpy.logspace() in both dimensions:

>>> x = np.exp(np.random.uniform(0, 1, size=(10000,)))
>>> y = np.exp(np.random.uniform(0, 1, size=(10000,)))
>>> bins = np.logspace(0.1, 1.0, 10, endpoint=True)
>>> h, __ = var2d(x, y, bins, bins)