Skip to main content
100%

Encircle Scatterplot with alpha shapes

✓ Published0🌍 Public
TThanaporn-sk
Last edited Jul 31, 2017
Created on Jul 31, 2017

This visualization shows a scatterplot matrix of the classic Iris flower dataset, with each cell displaying pairwise correlations between four measurements (sepal length, sepal width, petal length, petal width). The three species are distinguished by color, and each species’ points are encircled by an irregular polygon boundary. The boundaries are computed using an alpha-shape algorithm that filters Delaunay triangles from `d3.voronoi` by a distance threshold, then extracts connected triangle edges via a custom `boundary` function. The polygons are rendered as SVG paths using D3 v4’s data-binding, while axes and brushing interactions follow the standard scatterplot-matrix pattern.

AI-generated description

Using alpha shapes to group or "encircle" sets of points.

It's not fast, but it's fun.

DISCLAIMER: this code is quite hackish, don't copy it blindly.

TODO: buffer the shapes so that they nicely enclose dots as ggplot2's geom_encircle function does.


The scatterplot matrix visualizations pairwise correlations for multi-dimensional data; each cell in the matrix is a scatterplot. This example uses Anderson's data of iris flowers on the Gaspé Peninsula. Scatterplot matrix design invented by J. A. Hartigan; see also R and GGobi. Data on Iris flowers collected by Edgar Anderson and published by Ronald Fisher.

S Forked from mbostock’s <a href='http://bl.ocks.org/mbostock/4063663'>Scatterplot Matrix Brushing</a>.

forked from <a href='http://bl.ocks.org/Fil/'>Fil</a>'s block: <a href='http://bl.ocks.org/Fil/9f550cd314c5c1fb1c5738df24027644'>Encircle Scatterplot with alpha shapes</a>

gpl-3.0 Licensed

Similar vizzes