- sherpa.utils.histogram2d(x, y, x_grid, y_grid)[source] [edit on github]
Create 2D histogram from a sequence of samples.
numpy.histogram2droutine for a version with more options.
x (sequence of numbers) – The array of samples (X coordinate)
y (sequence of numbers) – The array of samples (Y coordinate), which must have the same size as the
x_grid (sequence of numbers) – The X bin edges.
y_grid (sequence of numbers) – The Y bin edges.
y – The number of samples in each histogram bin defined by the
- Return type
Given a list of coordinates (
yvals), bin them up so that they match the 5 by 10 pixel image data space. In this case the X grid is [1, 2, …, 5] and the Y grid is [1, 2, .., 10].
>>> dataspace2d([5, 10]) >>> (xgrid, ygrid) = get_axes() >>> n = histogram2d(xvals, yvals, xgrid, ygrid) >>> set_dep(n)