Klar

Charts / React science and statistics charts / Relationship

Regression scatter

A grouped scatter with a least-squares fit, confidence and prediction bands, marginal densities and the fitted equation, with residuals on hover.

React component RegressionScatter, data through props. How variables move together: correlation, density and many dimensions at once. Tags: scatter, regression, trend-line, confidence-band, residuals, marginals, correlation.

Install

npm i klar-charts

import 'klar-charts/styles.css'
import { ThemeScope, RegressionScatter } from 'klar-charts'

# or copy the source:
npx shadcn@latest add https://klar.run/r/sci-regression-scatter.json

Usage

<RegressionScatter
  points={leafPoints}
  groups={leafGroups}
  height={420}
  xLabel="Leaf nitrogen (% dry mass)"
  yLabel="Aₘₐₓ (µmol CO₂ m⁻² s⁻¹)"
  xSymbol="N"
  ySymbol="A"
  showPI={band === 'pi'}
/>

Related regression scatter charts