# Facets and small multiples

> Repeat one chart as a grid of panels, one per category, with shared or independent scales and wrapped, row or column layouts.

Faceting repeats one chart as a grid of panels, one panel per value of a field. It is the better choice when several series overlap too much to read in one plot, or when the point is to compare shapes across groups.

When the series are few and do not overlap, one [line chart](/docs/change-over-time/line/) with a line per series keeps them in one view. When two marks belong in the same plot, use [layers](/docs/composition/layers/).

## A wrapped grid

`encoding.facet` wraps panels left to right. `columns` sets the grid width, and it is computed when omitted. Scales are shared by default, so panels are directly comparable, and redundant tick labels are stripped: y-axis labels show only on the leftmost column.

```json
{
  "mark": "line",
  "data": [
    {
      "date": "2018-01-01",
      "gdp": 3,
      "country": "United States"
    },
    {
      "date": "2019-01-01",
      "gdp": 2.5,
      "country": "United States"
    },
    {
      "date": "2020-01-01",
      "gdp": -2.2,
      "country": "United States"
    },
    {
      "date": "2021-01-01",
      "gdp": 6.1,
      "country": "United States"
    },
    {
      "date": "2022-01-01",
      "gdp": 2.5,
      "country": "United States"
    },
    {
      "date": "2023-01-01",
      "gdp": 2.9,
      "country": "United States"
    },
    {
      "date": "2024-01-01",
      "gdp": 2.8,
      "country": "United States"
    },
    {
      "date": "2018-01-01",
      "gdp": 1.8,
      "country": "Euro Area"
    },
    {
      "date": "2019-01-01",
      "gdp": 1.6,
      "country": "Euro Area"
    },
    {
      "date": "2020-01-01",
      "gdp": -6.1,
      "country": "Euro Area"
    },
    {
      "date": "2021-01-01",
      "gdp": 5.9,
      "country": "Euro Area"
    },
    {
      "date": "2022-01-01",
      "gdp": 3.4,
      "country": "Euro Area"
    },
    {
      "date": "2023-01-01",
      "gdp": 0.5,
      "country": "Euro Area"
    },
    {
      "date": "2024-01-01",
      "gdp": 0.8,
      "country": "Euro Area"
    },
    {
      "date": "2018-01-01",
      "gdp": 6.7,
      "country": "China"
    },
    {
      "date": "2019-01-01",
      "gdp": 6,
      "country": "China"
    },
    {
      "date": "2020-01-01",
      "gdp": 2.2,
      "country": "China"
    },
    {
      "date": "2021-01-01",
      "gdp": 8.4,
      "country": "China"
    },
    {
      "date": "2022-01-01",
      "gdp": 3,
      "country": "China"
    },
    {
      "date": "2023-01-01",
      "gdp": 5.2,
      "country": "China"
    },
    {
      "date": "2024-01-01",
      "gdp": 5,
      "country": "China"
    }
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y"
      }
    },
    "y": {
      "field": "gdp",
      "type": "quantitative",
      "axis": {
        "format": ".0f"
      }
    },
    "facet": {
      "field": "country",
      "type": "nominal",
      "columns": 3
    }
  },
  "chrome": {
    "title": "One panel per economy, one shared scale",
    "subtitle": "Annual real GDP growth split into a small-multiples grid by country (shared y-axis)"
  }
}
```

## Independent scales

`resolve: { scale: { y: "independent" } }` gives each panel its own y domain. Each economy then fills its frame, so the shape reads and the level does not. Use it to compare the shape of each series, and keep shared scales to compare levels.

```json
{
  "mark": "line",
  "data": [
    {
      "date": "2018-01-01",
      "gdp": 3,
      "country": "United States"
    },
    {
      "date": "2019-01-01",
      "gdp": 2.5,
      "country": "United States"
    },
    {
      "date": "2020-01-01",
      "gdp": -2.2,
      "country": "United States"
    },
    {
      "date": "2021-01-01",
      "gdp": 6.1,
      "country": "United States"
    },
    {
      "date": "2022-01-01",
      "gdp": 2.5,
      "country": "United States"
    },
    {
      "date": "2023-01-01",
      "gdp": 2.9,
      "country": "United States"
    },
    {
      "date": "2024-01-01",
      "gdp": 2.8,
      "country": "United States"
    },
    {
      "date": "2018-01-01",
      "gdp": 1.8,
      "country": "Euro Area"
    },
    {
      "date": "2019-01-01",
      "gdp": 1.6,
      "country": "Euro Area"
    },
    {
      "date": "2020-01-01",
      "gdp": -6.1,
      "country": "Euro Area"
    },
    {
      "date": "2021-01-01",
      "gdp": 5.9,
      "country": "Euro Area"
    },
    {
      "date": "2022-01-01",
      "gdp": 3.4,
      "country": "Euro Area"
    },
    {
      "date": "2023-01-01",
      "gdp": 0.5,
      "country": "Euro Area"
    },
    {
      "date": "2024-01-01",
      "gdp": 0.8,
      "country": "Euro Area"
    },
    {
      "date": "2018-01-01",
      "gdp": 6.7,
      "country": "China"
    },
    {
      "date": "2019-01-01",
      "gdp": 6,
      "country": "China"
    },
    {
      "date": "2020-01-01",
      "gdp": 2.2,
      "country": "China"
    },
    {
      "date": "2021-01-01",
      "gdp": 8.4,
      "country": "China"
    },
    {
      "date": "2022-01-01",
      "gdp": 3,
      "country": "China"
    },
    {
      "date": "2023-01-01",
      "gdp": 5.2,
      "country": "China"
    },
    {
      "date": "2024-01-01",
      "gdp": 5,
      "country": "China"
    }
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y"
      }
    },
    "y": {
      "field": "gdp",
      "type": "quantitative",
      "axis": {
        "format": ".0f"
      }
    },
    "facet": {
      "field": "country",
      "type": "nominal",
      "columns": 3
    }
  },
  "resolve": {
    "scale": {
      "y": "independent"
    }
  },
  "chrome": {
    "title": "Independent y-scales show each economy's swings at full height",
    "subtitle": "Each panel gets its own y-domain, so each economy fills its frame"
  }
}
```

## Panels in a single row

`encoding.column` places the panels side by side in one row. The y axis is shared by default and each panel gets its own x axis. Each panel has a 200px minimum width, and the columns degrade responsively below that.

```json
{
  "mark": "line",
  "data": [
    {
      "date": "2018-01-01",
      "gdp": 3,
      "country": "United States"
    },
    {
      "date": "2019-01-01",
      "gdp": 2.5,
      "country": "United States"
    },
    {
      "date": "2020-01-01",
      "gdp": -2.2,
      "country": "United States"
    },
    {
      "date": "2021-01-01",
      "gdp": 6.1,
      "country": "United States"
    },
    {
      "date": "2022-01-01",
      "gdp": 2.5,
      "country": "United States"
    },
    {
      "date": "2023-01-01",
      "gdp": 2.9,
      "country": "United States"
    },
    {
      "date": "2024-01-01",
      "gdp": 2.8,
      "country": "United States"
    },
    {
      "date": "2018-01-01",
      "gdp": 1.8,
      "country": "Euro Area"
    },
    {
      "date": "2019-01-01",
      "gdp": 1.6,
      "country": "Euro Area"
    },
    {
      "date": "2020-01-01",
      "gdp": -6.1,
      "country": "Euro Area"
    },
    {
      "date": "2021-01-01",
      "gdp": 5.9,
      "country": "Euro Area"
    },
    {
      "date": "2022-01-01",
      "gdp": 3.4,
      "country": "Euro Area"
    },
    {
      "date": "2023-01-01",
      "gdp": 0.5,
      "country": "Euro Area"
    },
    {
      "date": "2024-01-01",
      "gdp": 0.8,
      "country": "Euro Area"
    },
    {
      "date": "2018-01-01",
      "gdp": 6.7,
      "country": "China"
    },
    {
      "date": "2019-01-01",
      "gdp": 6,
      "country": "China"
    },
    {
      "date": "2020-01-01",
      "gdp": 2.2,
      "country": "China"
    },
    {
      "date": "2021-01-01",
      "gdp": 8.4,
      "country": "China"
    },
    {
      "date": "2022-01-01",
      "gdp": 3,
      "country": "China"
    },
    {
      "date": "2023-01-01",
      "gdp": 5.2,
      "country": "China"
    },
    {
      "date": "2024-01-01",
      "gdp": 5,
      "country": "China"
    }
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y"
      }
    },
    "y": {
      "field": "gdp",
      "type": "quantitative",
      "axis": {
        "format": ".0f"
      }
    },
    "column": {
      "field": "country",
      "type": "nominal"
    }
  },
  "chrome": {
    "title": "The same three economies in one row",
    "subtitle": "Annual real GDP growth, one column per country"
  }
}
```

## Panels in a single column

`encoding.row` stacks the panels vertically. It shares the x axis by default, so bar lengths line up between panels, and each panel gets its own y axis because the categories differ. `sort: null` keeps the panel order as it appears in the data.

```json
{
  "mark": {
    "type": "bar",
    "orient": "horizontal"
  },
  "data": [
    {
      "period": "2011-12",
      "state": "Oregon",
      "rate": 6.4,
      "party": "Blue"
    },
    {
      "period": "2011-12",
      "state": "Washington",
      "rate": 5.2,
      "party": "Blue"
    },
    {
      "period": "2011-12",
      "state": "Vermont",
      "rate": 4.8,
      "party": "Blue"
    },
    {
      "period": "2011-12",
      "state": "Colorado",
      "rate": 4.1,
      "party": "Blue"
    },
    {
      "period": "2024-25",
      "state": "Idaho",
      "rate": 8.1,
      "party": "Red"
    },
    {
      "period": "2024-25",
      "state": "Wyoming",
      "rate": 7.3,
      "party": "Red"
    },
    {
      "period": "2024-25",
      "state": "Alaska",
      "rate": 6.9,
      "party": "Red"
    },
    {
      "period": "2024-25",
      "state": "Utah",
      "rate": 5.8,
      "party": "Red"
    }
  ],
  "encoding": {
    "x": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "title": "Exemption rate (%)"
      }
    },
    "y": {
      "field": "state",
      "type": "nominal",
      "sort": null
    },
    "color": {
      "field": "party",
      "type": "nominal",
      "scale": {
        "range": [
          "#4373b8",
          "#d1495b"
        ]
      }
    },
    "row": {
      "field": "period",
      "type": "ordinal",
      "sort": null
    }
  },
  "chrome": {
    "title": "The highest exemption rates moved from blue states to red states",
    "subtitle": "Exemption rate in the four highest states, 2011-12 and 2024-25 (%)"
  }
}
```

## Fields that matter

| Field | What it does |
| --- | --- |
| `encoding.facet` | A wrapped grid of panels. Takes `field`, `type`, `sort` and `columns`. |
| `encoding.row` | Panels stacked vertically, one per value. |
| `encoding.column` | Panels side by side in one row. |
| `resolve.scale` | `"shared"` or `"independent"` per channel, such as `y`. The default is shared. |
| `sort` | On a facet channel, orders the panels. `null` keeps the data order. |

The three facet channels are mutually exclusive: `row` and `column` cannot be combined, and neither can be combined with `facet`.

## Related

- [Layers](/docs/composition/layers/) for several marks in one plot.
- [Line](/docs/change-over-time/line/) for a few series in one plot.
- [Bar](/docs/comparison/bar/) for the chart used in the row layout.
- [Encoding reference](/docs/spec/encoding/) lists the faceting fields along with every channel.
