D3 Scatterplot with Regression Line
✓ Published0🌍 Public
4456lumen
Last edited Jan 25, 2018
Created on Jan 25, 2018
This example visualizes the classic Iris dataset, plotting sepal length against petal length for three flower species—setosa, versicolor, and virginica—as colored circles in a D3 scatterplot. Each species has its own linear regression line, computed from the data and drawn as a path, with the lines in blue, red, and green to match the points. The visualization uses D3’s `d3.svg.axis` for axes, `d3.scale.linear` for positioning, and `d3.svg.line` to generate the regression curves, all rendered as SVG elements. The data is embedded directly in the script via a `create_data()` function, and the axes are labeled with the raw measurement units from the dataset.
AI-generated descriptionBuilt with blockbuilder.org
mit Licensed