Skip to content

Q-Q plot ​

Sorted values against those of a normal distribution, with the line they would follow. Good for checking whether a sample is normal, skewed or has heavy tails.

The smallest code that works. change the code, then press Run

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'qq',
  yLabel: 'Sample',
  data: [
    {
      name: 'Heights',
      values: [
        162.7, 165.2, 173, 159.2, 170.6, 171.6, 189.5, 181.1, 171, 169.2, 168.7, 160.2, 176.3,
        162.2, 173.8, 164.3, 170, 163.9, 183, 174.9, 160.4, 161.1, 177.1, 171.2, 175.8, 176.4, 168,
        159.8, 180.6, 165.2, 163.9, 158.2, 157.8, 175, 167, 162.7, 162.3, 180.7, 172.5, 180.2, 179,
        155.9, 168.1, 167.9, 155.5, 169.6, 173, 172.1, 178.5, 167.8, 160.6, 165.4, 160.5, 181.9,
        163.2, 171.3, 165, 175.8, 164.6, 167.9, 183.4, 154.5, 172.8, 194.5, 176.4, 179.6, 167.1,
        158.1, 164.1, 177.5, 172, 162.3, 186.7, 174.5, 159.5, 150.2, 181.7, 165.2, 164, 176.9,
      ],
    },
    {
      name: 'Waiting times',
      values: [
        160, 141, 165, 144, 144, 195, 171, 140, 205, 182, 131, 138, 205, 146, 288, 182, 200, 178,
        151, 151, 147, 139, 216, 163, 336, 158, 178, 137, 143, 149, 144, 144, 160, 158, 160, 190,
        175, 147, 158, 168, 163, 146, 147, 151, 163, 143, 143, 163, 182, 171, 190, 146, 200, 151,
        158, 129, 155, 141, 165, 178, 216, 163, 168, 171, 171, 147, 186, 147, 168, 182, 205, 137,
        138, 168, 136, 163, 155, 186, 165, 144,
      ],
    },
  ],
};

export default function Example() {
  return <Chart spec={spec} style={{ height: 340 }} />;
}

Or import this chart alone: what each import weighs.

Options

Beside the fields shared by every chart (title, format, heading, export…), type qq takes:

/** Quantiles of each sample against those of a normal distribution, with the line they follow if it is normal. */
interface QQSpec extends Base, Axes {
  type: 'qq';
  data: Sample[];
  legend?: boolean | LegendOptions;
}

interface Sample {
  name: string;

Style it

  • Colours: theme.palette, chart.setColor(name, colour), or --nervure-palette in your CSS. More
  • Marks: [data-series="name"], parts: [data-part="axes"], legend, series. What you change is kept in exports.
  • Movement: animation: false draws at once. More
  • Files: chart.download('png'), svg, csv. More

Close to it