pygram11.fix2d¶
-
pygram11.
fix2d
(x, y, bins=10, range=None, weights=None)[source]¶ Histogram the
x
,y
data with fixed (uniform) binning.- Parameters
x (array_like) – first entries in data pairs to histogram
y (array_like) – second entries in data pairs to histogram
bins (int or iterable) – if int, both dimensions will have that many bins, if iterable, the number of bins for each dimension
range (iterable, optional) – axis limits to histogram over in the form [(xmin, xmax), (ymin, ymax)]
weights (array_like, optional) – weight for each \((x_i, y_i)\) pair.
- Returns
numpy.ndarray
– The bin counts.numpy.ndarray
– The standard error of each bin count, \(\sqrt{\sum_i w_i^2}\).
Examples
A histogram of (
x
,y
) with 20 bins between 0 and 100 in thex
dimention and 10 bins between 0 and 50 in they
dimension:>>> h, __ = fix2d(x, y, bins=(20, 10), range=((0, 100), (0, 50)))
The same data, now histogrammed weighted (via
w
):>>> h, err = fix2d(x, y, bins=(20, 10), range=((0, 100), (0, 50)), weights=w)