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
- Scatter plot: Two measures plotted against each other and coloured by group, with median lines, named quadrants and labelled outliers.
- Bubble chart: A scatter plot with a third measure as bubble area and a fourth as colour, with a size key and names that never overlap.
- Correlation matrix: Pairwise correlations of twelve assets, clustered so related markets sit together, with each mark sized by the strength of the link.
- Spectrogram: Time–frequency power in dB on a canvas raster with harmonic callouts and annotation bands, for spotting tones, sweeps and resonances in a…
- Raincloud plot: Half-violin, box plot and raw points per group in one row, so the shape, the summary and every observation are visible at once.
- Histogram with density: A histogram with its kernel density, a fitted normal, quantile tails and a summary box, for judging skew and fit at a glance.