# Parliament

> Draw legislative seats as dots in a hemicycle grouped by party, then add a multi-party chamber, hide the majority line or move it to a custom threshold.

A parliament chart draws a legislature as a hemicycle: dots packed into concentric arcs and grouped by party from left to right. It is the standard form for legislative composition, where who holds a majority is the question.

Use a [pie or donut](/docs/part-to-whole/pie-donut/) for shares of a whole that is not a set of seats, or a [waffle chart](/docs/part-to-whole/waffle/) when the units are not seats. A [bar chart](/docs/comparison/bar/) ranks groups by size more precisely than a hemicycle does.

The demos on this page draw one dot per five seats, computed from the seat counts, to keep the page light. The mark draws one dot per unit of the `theta` value, so a spec with one dot per seat just uses the seat counts.

## A basic parliament

Set `mark` to `"parliament"`, put the count on `theta` and the party on `color`. Order the data left to right by political group, because the layout keeps that order across the arc. Party colors usually come from an explicit `scale.range`. A majority line and an "N to win" label are drawn by default, and `majorityLine` on the mark can replace the label text. Here it names the real threshold of 218 seats, because the dot count is a fifth of the seat count.

```json
{
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 44,
      "label": "218 seats to win"
    }
  },
  "data": [
    {
      "party": "Democratic",
      "dots": 43
    },
    {
      "party": "Republican",
      "dots": 44
    }
  ],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "party",
      "type": "nominal",
      "scale": {
        "domain": [
          "Democratic",
          "Republican"
        ],
        "range": [
          "#1b7fa3",
          "#c44e52"
        ]
      }
    }
  },
  "chrome": {
    "title": "Republicans hold a narrow House majority",
    "subtitle": "US House of Representatives, 435 seats. Each dot is five seats."
  }
}
```

## Many groups

The same spec works with more than two groups. Here eight groups share 705 seats, ordered along the political spectrum so neighboring blocks read as a gradient. The category field can have any name; this data calls it `group`. No group would pass a simple majority alone, so `majorityLine: false` hides the line and its label. Use it when a chamber has no single voting threshold to show.

```json
{
  "mark": {
    "type": "parliament",
    "majorityLine": false
  },
  "data": [
    {
      "group": "Left",
      "dots": 8
    },
    {
      "group": "Greens",
      "dots": 14
    },
    {
      "group": "S&D",
      "dots": 28
    },
    {
      "group": "Renew",
      "dots": 20
    },
    {
      "group": "EPP",
      "dots": 36
    },
    {
      "group": "ECR",
      "dots": 14
    },
    {
      "group": "ID",
      "dots": 10
    },
    {
      "group": "Non-attached",
      "dots": 12
    }
  ],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "No group holds a majority alone",
    "subtitle": "705 seats ordered left to right by political group. Each dot is five seats."
  }
}
```

## A custom threshold

`majorityLine` takes an object to move the line. `seats` sets the threshold, here 470 seats scaled to dots, which is two thirds of 705, and `label` replaces the default "N to win" text. A `seats` value outside the range from 1 to the total warns and falls back to a simple majority.

```json
{
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 94,
      "label": "470 seats for two-thirds"
    }
  },
  "data": [
    {
      "group": "Left",
      "dots": 8
    },
    {
      "group": "Greens",
      "dots": 14
    },
    {
      "group": "S&D",
      "dots": 28
    },
    {
      "group": "Renew",
      "dots": 20
    },
    {
      "group": "EPP",
      "dots": 36
    },
    {
      "group": "ECR",
      "dots": 14
    },
    {
      "group": "ID",
      "dots": 10
    },
    {
      "group": "Non-attached",
      "dots": 12
    }
  ],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "The line can mark a supermajority instead",
    "subtitle": "705 seats with the threshold set to 470. Each dot is five seats."
  }
}
```

## Fields that matter

| Field | What it does |
| --- | --- |
| `mark` | `"parliament"`, or an object that sets `majorityLine`, `seatRadius` and `shape`. |
| `mark.majorityLine` | `true` by default. `false` hides it; `{ seats, label }` sets a custom threshold and text. |
| `mark.seatRadius` | Dot radius in pixels. `"auto"` sizes dots to fill the rings. |
| `encoding.theta` | The count of each party, one dot per unit. |
| `encoding.color` | The party. `scale.domain` and `scale.range` pin parties to colors. |

## Related

- [Pie and donut](/docs/part-to-whole/pie-donut/) includes a half donut for chamber control.
- [Waffle](/docs/part-to-whole/waffle/) for shares as countable squares.
- [Stacked 100%](/docs/part-to-whole/stacked-100/) for shares across several wholes.
- [Choropleth](/docs/maps/choropleth/) for results by region.
- [Marks reference](/docs/spec/marks/) lists the channels and options each mark type takes.
