A matrix of scatter plots in D3/TypeScript
This piece of code originates from one of the visualization tasks I needed to take on for work. It required visualizing a suitable subset of a covariance matrix, in which each quadrant would contain a plotted preview of the relationship between two features in a dataset. Features were generated by a feature generation stage within a larger machine learning pipeline, thus being able to grasp how such features changed together was a point of interest. On top of that, we also wanted to analyze the distribution of a binary class across the spectral subset of the final high-dimensional space.
Building on top of a popular example, I refactored, reorganized and modified that code in order to be compatible with typescript and to reduce the number of filter/map/reduce operations carried out in a unit of time. That was a requirement because the frontend in which we would embed the chart was already consuming quite a bit of resources and didn’t have much left to spare.
Feel free to play with the following sandbox and read its source code.