Footnotes provide a way to annotate specific cells, columns, or other table parts with additional context without cluttering the main display. Great Tables manages footnotes as a system: marks are automatically sequenced, placed consistently, and matched to their explanatory text in the table footer.
Footnotes are best suited for cell-specific or column-specific context that would clutter the main display if placed inline. For information that applies to the entire table, a source note in the footer (via tab_source_note()) is usually a better fit because it avoids attaching a mark to any one location. And for systematic column descriptions, such as units or definitions, consider relabeling the column itself so the context is always visible without requiring the reader to look down at the footer.
Targeting Different Locations
Footnotes can be attached to many different parts of the table. The locations= argument accepts any of the loc specifiers that support footnotes. Here are some of the most common targets.
Column Labels
Attaching a footnote to a column label is useful for clarifying units or methodology.
(
GT(weather_mini)
.tab_header(title="Weather at Gibraltar Airport", subtitle="Observations on May 1, 2023")
.tab_footnote(
footnote="Relative humidity, as a value between 0 and 1.",
locations=loc.column_labels(columns="humidity")
)
)
| Weather at Gibraltar Airport |
| Observations on May 1, 2023 |
| date |
time |
temp |
humidity |
wind_speed |
pressure |
| 2023-05-01 |
00:20 |
18.9 |
0.68 |
6.7 |
1015.2 |
| 2023-05-01 |
00:50 |
18.9 |
0.73 |
7.2 |
1015.2 |
| 2023-05-01 |
01:20 |
17.8 |
0.77 |
6.7 |
1014.6 |
| 2023-05-01 |
01:50 |
18.9 |
0.73 |
6.7 |
1014.6 |
| 2023-05-01 |
02:20 |
18.9 |
0.68 |
6.7 |
1014.6 |
Body Cells
You can annotate specific data cells by targeting them with loc.body().
(
GT(weather_mini)
.tab_header(title="Weather at Gibraltar Airport", subtitle="Observations on May 1, 2023")
.tab_footnote(
footnote="Lowest temperature in this sample.",
locations=loc.body(columns="temp", rows=[2])
)
)
| Weather at Gibraltar Airport |
| Observations on May 1, 2023 |
| date |
time |
temp |
humidity |
wind_speed |
pressure |
| 2023-05-01 |
00:20 |
18.9 |
0.68 |
6.7 |
1015.2 |
| 2023-05-01 |
00:50 |
18.9 |
0.73 |
7.2 |
1015.2 |
| 2023-05-01 |
01:20 |
17.8 |
0.77 |
6.7 |
1014.6 |
| 2023-05-01 |
01:50 |
18.9 |
0.73 |
6.7 |
1014.6 |
| 2023-05-01 |
02:20 |
18.9 |
0.68 |
6.7 |
1014.6 |
The Title or Subtitle
Footnotes on the table header can provide methodological notes or data source context.
(
GT(weather_mini)
.tab_header(title="Weather at Gibraltar Airport", subtitle="Observations on May 1, 2023")
.tab_footnote(
footnote="Data collected at the airport's weather station, 5 m above mean sea level.",
locations=loc.title()
)
)
| Weather at Gibraltar Airport |
| Observations on May 1, 2023 |
| date |
time |
temp |
humidity |
wind_speed |
pressure |
| 2023-05-01 |
00:20 |
18.9 |
0.68 |
6.7 |
1015.2 |
| 2023-05-01 |
00:50 |
18.9 |
0.73 |
7.2 |
1015.2 |
| 2023-05-01 |
01:20 |
17.8 |
0.77 |
6.7 |
1014.6 |
| 2023-05-01 |
01:50 |
18.9 |
0.73 |
6.7 |
1014.6 |
| 2023-05-01 |
02:20 |
18.9 |
0.68 |
6.7 |
1014.6 |
Controlling Mark Placement
The placement= argument determines where the footnote mark appears relative to the cell content. The options are "auto" (the default), "left", and "right".
(
GT(weather_mini)
.tab_header(title="Weather at Gibraltar Airport", subtitle="Observations on May 1, 2023")
.tab_footnote(
footnote="Wind speed in meters per second.",
locations=loc.column_labels(columns="wind_speed"),
placement="left"
)
)
| Weather at Gibraltar Airport |
| Observations on May 1, 2023 |
| date |
time |
temp |
humidity |
wind_speed |
pressure |
| 2023-05-01 |
00:20 |
18.9 |
0.68 |
6.7 |
1015.2 |
| 2023-05-01 |
00:50 |
18.9 |
0.73 |
7.2 |
1015.2 |
| 2023-05-01 |
01:20 |
17.8 |
0.77 |
6.7 |
1014.6 |
| 2023-05-01 |
01:50 |
18.9 |
0.73 |
6.7 |
1014.6 |
| 2023-05-01 |
02:20 |
18.9 |
0.68 |
6.7 |
1014.6 |
With placement="left", the footnote mark appears before the cell text rather than after it.