I am finding it hard to construct a weighed 2D histogram.
Let us assume that we have two vectors, X and Y, of equal length N such that the entries in each of X and Y are not necessarily unique. Similarly, let's assume that W represents an array of N non-unique, non-integer values weighing each sample point [ X(i), Y(i) ].
To construct a standard 2D histogram, I am aware one can simply use
to plot (along the z-axis) the sum/count of number of points per bin.
My question: how can I modify this to account for the weight of every sample point within a bin? That is, for the result to be the sum of the weights of all points within a bin.
(Note that this is not equivalent to merely weighing the count per bin by a constant value)
Thanks for any suggestions!