xy2hist

edge_pydb.plotting.xy2hist(xarr, yarr, log=True, bins=[100, 100])[source]

Prepare a 2D density histogram from a scatterplot. Based on a response to a Stack Overflow question: stackoverflow.com/questions/49662964/density-scatter-plot-for-huge-dataset-in-matplotlib

Parameters:
xarrnumpy.array

The x values in the scatter plot

yarrnumpy.array

The y values in the scatter plot

logboolean

If True, take the log of input x and y, and of output density z

binslist of int

The number of bins in x and y for the histogram

Returns:
xnumpy.array

x values sorted by increasing density

ynumpy.array

y values sorted by increasing density

znumpy.array

histogram count for each point

hhnumpy.ndarray

2D histogram values

locxnumpy.array

bin edges along first dimension

locynumpy.array

bin edges along second dimension