I would like to create a 2D histogram (using graph objects) where the counts should come from a separate sequence.
So instead of counting the number of elements for each interval on the x axis, the plot should show the sum of all the counts from the second sequence for the elements corresponding to the values in the x interval.
This is the list of binning functions for go.Histogram2d:
help(go.Histogram2d.histfunc)
Help on property:
Specifies the binning function used for this histogram trace.
If "count", the histogram values are computed by counting the
number of values lying inside each bin. If "sum", "avg", "min",
"max", the histogram values are computed using the sum, the
average, the minimum or the maximum of the values lying inside
each bin respectively.
The 'histfunc' property is an enumeration that may be specified as:
- One of the following enumeration values:
['count', 'sum', 'avg', 'min', 'max']
Returns
-------
Any
I donβt understand very well your binning rule, but you can implement a function that computes the number, z, of points in each bin, according to this rule, and plot the Heatmap corresponding to your derived z-data, and x, y.
Thanks, that hint was very helpful!
The help text is IMO a bit confusing as it does not say what the βvaluesβ are here: the histogram values could be the xβs which get binned and counted per bin, or, what I need: additional values for each x which should get averaged or summed.
Here is the working code which creates the histogram 12,3,3, I need