In DensityMapBox source code where is the KDE calculated?

Hello everybody,

I’ve been poking around the plotly.js repo a bit to try and follow the flow for a DensityMapBox plot to figure out the nuts and bolts of it. I’ve been making working on my own geo-KDE method and I used DensityMapBox as a sanity check, and was really impressed with how snappy it was for a pretty large dataset. I was hoping to poke through the source code to see what was happening under the hood but I can’t seem to find the actual aggregation calculation.

Would anybody be willing / able to explain the general flow of this plotting code execution and point out where the numerical aggregation for the KDE takes place?

Thanks in advance,

Hello @cwolf2222,

Welcome to the community!

I don’t know how the code works, but @alexcjohnson may be able to shed some light on this.

Hi @cwolf2222 - my apologies, just saw this question now.

I believe this is being handled inside MapBox, not by plotly.js per se, which would explain why you can’t find it in the code! And as to its snappiness, I bet this is handled in WebGL shaders.