Scatterplot with Lasso
This interactive scatterplot uses the D3 lasso plugin to let users select clusters of points by drawing a freehand lasso around them. The visualization plots the classic Iris dataset with sepal length and sepal width on the axes, colored by species. Once a lasso is drawn, the chart updates dynamically—points inside the selection are highlighted while those outside are dimmed, and summary statistics for the selected points are recalculated in real time. The lasso provides a direct, fluid way to explore grouping and density in the data, with selected points visually emphasized in red and unselected points faded to gray, making the selection state immediately apparent. The example is built with D3 v3 and uses SVG rendering, with the lasso interaction provided by the d3-lasso plugin.
AI-generated descriptionThis example demonstrates incorporating the d3 lasso plugin with a d3 scatterplot. Clicking and dragging on the plot area will produce a lasso that can be used to hover or loop around the dots in the scatterplot. Functions are then executed based on whether dots were selected or not.
The lasso plugin can be found here.
forked from <a href='http://bl.ocks.org/skokenes/'>skokenes</a>'s block: <a href='http://bl.ocks.org/skokenes/511c5b658c405ad68941'>Scatterplot with Lasso</a>