GitHub

Scatter chart

A scatter plots numbers against numbers. The first column is the horizontal axis, and each other column is a set of points.

The chart this block draws
```s-chart
type: scatter
title: Height and weight
x-label: Height (cm)
y-label: Weight (kg)
---
| Height | Weight |
| ------ | ------ |
| 158    | 54     |
| 162    | 59     |
| 165    | 61     |
| 170    | 66     |
| 172    | 70     |
| 175    | 72     |
| 178    | 77     |
| 181    | 79     |
| 185    | 84     |
```

When to use it

Use a scatter to see whether two measures move together: height and weight, hours and score, price and sales.

Options

OptionOn a scatter chart
type: scatterRequired.
titleText above the chart.
x-labelTitle for the horizontal axis, which comes from the first column.
y-labelTitle for the vertical axis.
legendtop, bottom or none. Shown for two or more sets of points.
heightChart height in pixels, 120 to 1200.
colorsOne colour per set of points.
paletteA palette from settings.
source, x, yDraw from note properties. x must be a number property.

stacked and horizontal have no effect.

The first column must be numbers

Unlike other types, the first column of a scatter is a number axis, not labels. A cell such as one stops the chart with "scatter needs a number in the first column". The number formats from Writing the table all work here.

Two sets of points

Each extra column is another set of points, in its own colour. An empty cell skips that point.

The chart this block draws
```s-chart
type: scatter
title: Two groups
x-label: Hours studied
y-label: Score
---
| Hours | Class A | Class B |
| ----- | ------- | ------- |
| 1     | 52      | 48      |
| 2     | 58      | 55      |
| 3     | 61      |         |
| 4     | 70      | 64      |
| 5     | 74      | 69      |
| 6     | 81      | 77      |
```