Skip to main content
100%

Reusable Scatter Plot

✓ Published1🌍 Public
GGARIDIDEEKSHITHREDDY
Last edited Mar 29, 2022
Created on Mar 29, 2022

This example animates the classic Iris dataset in a reusable scatter plot, cycling through four different feature pairs on the x-axis while keeping sepal length fixed on the y-axis. Points are colored by species (setosa, versicolor, virginica) with a custom legend, and the plot updates every few seconds using `setInterval`. Built with D3 v6, it uses `d3.scaleLinear` for axes, `d3.axisLeft` and `d3.axisBottom` for scales, and SVG circles for marks. The `scatterPlot` factory function encapsulates the chart’s dimensions, margins, and scales, making the visualization modular and reusable.

AI-generated description
MIT Licensed

Similar vizzes