# Tick strip

> Draw one short tick per observation along a shared axis to show the spread of values in each group, then color the strips and add a reference line.

A tick strip draws one short line per observation along a value axis, so the whole spread of a group reads at once: where values cluster, where they thin out and where the extremes sit. Stacking one strip per group lets you compare spreads directly.

Ticks overlap when the data is dense. Switch to a [beeswarm](/docs/distribution/beeswarm/) to dodge the points apart, or to a [histogram](/docs/distribution/histogram/) when counts matter more than individual values. To compare one summary number per group, use a [bar chart](/docs/comparison/bar/).

## A basic tick strip

Set `mark` to `"tick"`, put the value on `x` and the group on `y`. Each row of the data becomes one tick. The tick mark needs a `y` channel; the spec fails validation without one.

```json
{
  "mark": "tick",
  "data": [
    {
      "group": "20-29",
      "hours": 3.1
    },
    {
      "group": "20-29",
      "hours": 3.4
    },
    {
      "group": "20-29",
      "hours": 3.6
    },
    {
      "group": "20-29",
      "hours": 3.8
    },
    {
      "group": "20-29",
      "hours": 4
    },
    {
      "group": "20-29",
      "hours": 4.3
    },
    {
      "group": "20-29",
      "hours": 4.7
    },
    {
      "group": "30-39",
      "hours": 3
    },
    {
      "group": "30-39",
      "hours": 3.3
    },
    {
      "group": "30-39",
      "hours": 3.7
    },
    {
      "group": "30-39",
      "hours": 3.9
    },
    {
      "group": "30-39",
      "hours": 4.1
    },
    {
      "group": "30-39",
      "hours": 4.4
    },
    {
      "group": "30-39",
      "hours": 4.9
    },
    {
      "group": "40-49",
      "hours": 3.2
    },
    {
      "group": "40-49",
      "hours": 3.6
    },
    {
      "group": "40-49",
      "hours": 4
    },
    {
      "group": "40-49",
      "hours": 4.2
    },
    {
      "group": "40-49",
      "hours": 4.5
    },
    {
      "group": "40-49",
      "hours": 5
    },
    {
      "group": "40-49",
      "hours": 5.4
    },
    {
      "group": "50-59",
      "hours": 3.5
    },
    {
      "group": "50-59",
      "hours": 4
    },
    {
      "group": "50-59",
      "hours": 4.4
    },
    {
      "group": "50-59",
      "hours": 4.8
    },
    {
      "group": "50-59",
      "hours": 5.2
    },
    {
      "group": "50-59",
      "hours": 5.6
    },
    {
      "group": "50-59",
      "hours": 6.1
    },
    {
      "group": "60+",
      "hours": 4.1
    },
    {
      "group": "60+",
      "hours": 4.6
    },
    {
      "group": "60+",
      "hours": 5.1
    },
    {
      "group": "60+",
      "hours": 5.5
    },
    {
      "group": "60+",
      "hours": 6
    },
    {
      "group": "60+",
      "hours": 6.5
    },
    {
      "group": "60+",
      "hours": 7
    }
  ],
  "encoding": {
    "x": {
      "field": "hours",
      "type": "quantitative",
      "axis": {
        "title": "Finish time (hours)"
      }
    },
    "y": {
      "field": "group",
      "type": "nominal",
      "axis": {
        "title": "Age group"
      }
    }
  },
  "chrome": {
    "title": "26 of 35 finishers took five hours or less",
    "subtitle": "Individual marathon finishers by age group. Each tick is one runner."
  }
}
```

## Colored strips

A `color` channel on the same field as `y` gives each strip its own color. The strips are already labeled on the axis, so `legend: { show: false }` drops the legend.

```json
{
  "mark": "tick",
  "data": [
    {
      "group": "20-29",
      "hours": 3.1
    },
    {
      "group": "20-29",
      "hours": 3.4
    },
    {
      "group": "20-29",
      "hours": 3.6
    },
    {
      "group": "20-29",
      "hours": 3.8
    },
    {
      "group": "20-29",
      "hours": 4
    },
    {
      "group": "20-29",
      "hours": 4.3
    },
    {
      "group": "20-29",
      "hours": 4.7
    },
    {
      "group": "30-39",
      "hours": 3
    },
    {
      "group": "30-39",
      "hours": 3.3
    },
    {
      "group": "30-39",
      "hours": 3.7
    },
    {
      "group": "30-39",
      "hours": 3.9
    },
    {
      "group": "30-39",
      "hours": 4.1
    },
    {
      "group": "30-39",
      "hours": 4.4
    },
    {
      "group": "30-39",
      "hours": 4.9
    },
    {
      "group": "40-49",
      "hours": 3.2
    },
    {
      "group": "40-49",
      "hours": 3.6
    },
    {
      "group": "40-49",
      "hours": 4
    },
    {
      "group": "40-49",
      "hours": 4.2
    },
    {
      "group": "40-49",
      "hours": 4.5
    },
    {
      "group": "40-49",
      "hours": 5
    },
    {
      "group": "40-49",
      "hours": 5.4
    },
    {
      "group": "50-59",
      "hours": 3.5
    },
    {
      "group": "50-59",
      "hours": 4
    },
    {
      "group": "50-59",
      "hours": 4.4
    },
    {
      "group": "50-59",
      "hours": 4.8
    },
    {
      "group": "50-59",
      "hours": 5.2
    },
    {
      "group": "50-59",
      "hours": 5.6
    },
    {
      "group": "50-59",
      "hours": 6.1
    },
    {
      "group": "60+",
      "hours": 4.1
    },
    {
      "group": "60+",
      "hours": 4.6
    },
    {
      "group": "60+",
      "hours": 5.1
    },
    {
      "group": "60+",
      "hours": 5.5
    },
    {
      "group": "60+",
      "hours": 6
    },
    {
      "group": "60+",
      "hours": 6.5
    },
    {
      "group": "60+",
      "hours": 7
    }
  ],
  "encoding": {
    "x": {
      "field": "hours",
      "type": "quantitative",
      "axis": {
        "title": "Finish time (hours)"
      }
    },
    "y": {
      "field": "group",
      "type": "nominal",
      "axis": {
        "title": "Age group"
      }
    },
    "color": {
      "field": "group",
      "type": "nominal"
    }
  },
  "legend": {
    "show": false
  },
  "chrome": {
    "title": "Finish times spread wider with age",
    "subtitle": "Individual marathon finishers by age group. Each tick is one runner."
  }
}
```

## A reference line

A `refline` annotation draws a threshold in data units across every strip, so you can read how many ticks fall on each side. Here the line marks four hours.

```json
{
  "mark": "tick",
  "data": [
    {
      "group": "20-29",
      "hours": 3.1
    },
    {
      "group": "20-29",
      "hours": 3.4
    },
    {
      "group": "20-29",
      "hours": 3.6
    },
    {
      "group": "20-29",
      "hours": 3.8
    },
    {
      "group": "20-29",
      "hours": 4
    },
    {
      "group": "20-29",
      "hours": 4.3
    },
    {
      "group": "20-29",
      "hours": 4.7
    },
    {
      "group": "30-39",
      "hours": 3
    },
    {
      "group": "30-39",
      "hours": 3.3
    },
    {
      "group": "30-39",
      "hours": 3.7
    },
    {
      "group": "30-39",
      "hours": 3.9
    },
    {
      "group": "30-39",
      "hours": 4.1
    },
    {
      "group": "30-39",
      "hours": 4.4
    },
    {
      "group": "30-39",
      "hours": 4.9
    },
    {
      "group": "40-49",
      "hours": 3.2
    },
    {
      "group": "40-49",
      "hours": 3.6
    },
    {
      "group": "40-49",
      "hours": 4
    },
    {
      "group": "40-49",
      "hours": 4.2
    },
    {
      "group": "40-49",
      "hours": 4.5
    },
    {
      "group": "40-49",
      "hours": 5
    },
    {
      "group": "40-49",
      "hours": 5.4
    },
    {
      "group": "50-59",
      "hours": 3.5
    },
    {
      "group": "50-59",
      "hours": 4
    },
    {
      "group": "50-59",
      "hours": 4.4
    },
    {
      "group": "50-59",
      "hours": 4.8
    },
    {
      "group": "50-59",
      "hours": 5.2
    },
    {
      "group": "50-59",
      "hours": 5.6
    },
    {
      "group": "50-59",
      "hours": 6.1
    },
    {
      "group": "60+",
      "hours": 4.1
    },
    {
      "group": "60+",
      "hours": 4.6
    },
    {
      "group": "60+",
      "hours": 5.1
    },
    {
      "group": "60+",
      "hours": 5.5
    },
    {
      "group": "60+",
      "hours": 6
    },
    {
      "group": "60+",
      "hours": 6.5
    },
    {
      "group": "60+",
      "hours": 7
    }
  ],
  "encoding": {
    "x": {
      "field": "hours",
      "type": "quantitative",
      "axis": {
        "title": "Finish time (hours)"
      }
    },
    "y": {
      "field": "group",
      "type": "nominal",
      "axis": {
        "title": "Age group"
      }
    },
    "color": {
      "field": "group",
      "type": "nominal"
    }
  },
  "legend": {
    "show": false
  },
  "annotations": [
    {
      "type": "refline",
      "x": 4,
      "label": "4 hours",
      "style": "dashed"
    }
  ],
  "chrome": {
    "title": "Few runners over 50 break four hours",
    "subtitle": "Individual marathon finishers by age group"
  }
}
```

## Another dataset

The same spec works on any one-number-per-row data. This one shows invented household incomes in four Census regions, with the strips wider where incomes vary more.

```json
{
  "mark": "tick",
  "data": [
    {
      "income": 22,
      "region": "South"
    },
    {
      "income": 28,
      "region": "South"
    },
    {
      "income": 31,
      "region": "South"
    },
    {
      "income": 35,
      "region": "South"
    },
    {
      "income": 38,
      "region": "South"
    },
    {
      "income": 42,
      "region": "South"
    },
    {
      "income": 45,
      "region": "South"
    },
    {
      "income": 48,
      "region": "South"
    },
    {
      "income": 55,
      "region": "South"
    },
    {
      "income": 62,
      "region": "South"
    },
    {
      "income": 78,
      "region": "South"
    },
    {
      "income": 30,
      "region": "Northeast"
    },
    {
      "income": 36,
      "region": "Northeast"
    },
    {
      "income": 42,
      "region": "Northeast"
    },
    {
      "income": 48,
      "region": "Northeast"
    },
    {
      "income": 52,
      "region": "Northeast"
    },
    {
      "income": 58,
      "region": "Northeast"
    },
    {
      "income": 65,
      "region": "Northeast"
    },
    {
      "income": 72,
      "region": "Northeast"
    },
    {
      "income": 82,
      "region": "Northeast"
    },
    {
      "income": 95,
      "region": "Northeast"
    },
    {
      "income": 115,
      "region": "Northeast"
    },
    {
      "income": 25,
      "region": "Midwest"
    },
    {
      "income": 30,
      "region": "Midwest"
    },
    {
      "income": 34,
      "region": "Midwest"
    },
    {
      "income": 38,
      "region": "Midwest"
    },
    {
      "income": 42,
      "region": "Midwest"
    },
    {
      "income": 46,
      "region": "Midwest"
    },
    {
      "income": 50,
      "region": "Midwest"
    },
    {
      "income": 55,
      "region": "Midwest"
    },
    {
      "income": 60,
      "region": "Midwest"
    },
    {
      "income": 68,
      "region": "Midwest"
    },
    {
      "income": 85,
      "region": "Midwest"
    },
    {
      "income": 32,
      "region": "West"
    },
    {
      "income": 38,
      "region": "West"
    },
    {
      "income": 44,
      "region": "West"
    },
    {
      "income": 50,
      "region": "West"
    },
    {
      "income": 56,
      "region": "West"
    },
    {
      "income": 62,
      "region": "West"
    },
    {
      "income": 70,
      "region": "West"
    },
    {
      "income": 78,
      "region": "West"
    },
    {
      "income": 88,
      "region": "West"
    },
    {
      "income": 105,
      "region": "West"
    },
    {
      "income": 130,
      "region": "West"
    }
  ],
  "encoding": {
    "x": {
      "field": "income",
      "type": "quantitative",
      "axis": {
        "title": "Household income ($K)"
      }
    },
    "y": {
      "field": "region",
      "type": "nominal"
    },
    "color": {
      "field": "region",
      "type": "nominal"
    }
  },
  "legend": {
    "show": false
  },
  "chrome": {
    "title": "The West and Northeast reach the highest incomes",
    "subtitle": "Sampled households by Census region. Each tick is one household."
  }
}
```

## Fields that matter

| Field | What it does |
| --- | --- |
| `mark` | `"tick"` draws one short line per row. |
| `encoding.x` | The quantitative value each tick is placed at. |
| `encoding.y` | A nominal field that names each strip. Required for the tick mark. |
| `encoding.color` | Optional. Colors each strip by group. |
| `legend.show` | Set to false to hide a legend the axis labels already replace. |
| `annotations` | A `refline` with `x` draws a reference value across the strips. |

## Related

- [Beeswarm](/docs/distribution/beeswarm/): dodge dense points apart.
- [Histogram](/docs/distribution/histogram/): count values in bins.
- [Error bars](/docs/distribution/error-bars/): show an interval instead of every observation.
- [Range](/docs/comparison/range/): compare a start and an end per category.
- [Scatter](/docs/correlation/scatter/): place observations by two numbers.
- [Marks reference](/docs/spec/marks/): the channels and options each mark type takes.
