Skip to main content
100%

Linear Regression Line with D3.js

✓ Published2🌍 Public
Mmkt-ds
Last edited Sep 27, 2019
Created on Sep 26, 2019

This visualization plots the correlation between a country's happiness score and its health expenditure per person, using a scatter plot of circles and an overlaid linear regression trendline. The data is loaded from a CSV file via `d3.csv` and rendered as SVG. The least-squares computation is performed manually in `index.js` to calculate slope, intercept, and r-squared, which are then used to draw the line via `d3.svg.line` and the `d3.scale.linear` axis scales.

AI-generated description

A regression line visualization using D3 and vega-lite

MIT Licensed

Similar vizzes