Klar

Charts / React basic charts / Relationship

Scatter plot

Two measures plotted against each other and coloured by group, with median lines, named quadrants and labelled outliers.

React component ScatterPlot, data through props. How variables move together: correlation, density and many dimensions at once. Tags: scatter, correlation, xy, quadrant, outliers, points, relationship.

Install

npm i klar-charts

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

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

Usage

<ScatterPlot
  data={stores}
  groups={storeFormats}
  xLabel="Visitors per week"
  yLabel="Conversion rate"
  unit="percent"
  reference={{ x: 11_600, y: 0.221, xLabel: 'Median 11.6K', yLabel: 'Median 22.1%' }}
  quadrants={['Quiet, converting', 'Busy, converting', 'Quiet, browsing', 'Busy, browsing']}
  labelOutliers={5}
  height={400}
  ariaLabel="Conversion rate against weekly visitors for 99 stores"
/>

Related scatter plot charts