Example with a custom reducer function for Bin

I want to plot a histogram with a custom reducer function in Plot.binX instead of the predefined count etc. It is possible according to the docs:

In addition, a reducer may be specified as:
- a function to be passed the array of values for each bin and the extent of the bin

but I am unable to make it work. Is there an example somewhere of this?


Here’s an example where I use a custom reducer to normalize the of the rectangles so that the total area is equal to one:


Thanks! I was close, but not quite there. This solves it, and is close to my actual use case.

1 Like