pygram11.histogram2d

pygram11.histogram2d(x, y, bins=10, range=None, weights=None)[source]

Histogram data in two dimensions.

This function provides an API very simiar to numpy.histogram2d(). Keep in mind that the returns are different.

Parameters
  • x (array_like) – Array representing the x coordinate of the data to histogram.

  • y (array_like) – Array representing the y coordinate of the data to histogram.

  • bins (int or array_like or [int, int] or [array, array], optional) –

    The bin specification:
    • If int, the number of bins for the two dimensions (nx = ny = bins).

    • If array_like, the bin edges for the two dimensions (x_edges = y_edges = bins).

    • If [int, int], the number of bins in each dimension (nx, ny = bins).

    • If [array_like, array_like], the bin edges in each dimension (x_edges, y_edges = bins).

  • range (array_like, shape(2,2), optional) – The edges of this histogram along each dimension. If bins is not integral, then this parameter is ignored. If None, the default is [[x.min(), x.max()], [y.min(), y.max()]].

  • weights (array_like) – An array of weights associated to each element \((x_i, y_i)\) pair. Each pair of the data will contribute its associated weight to the bin count.

Returns

Examples

>>> h, err = histogram2d(x, y, weights=w)