Skip to contents

The look of a printed statistical abstract. A slab body, narrow condensed labels, tight rows, and row banding to walk the eye across a wide table.

Usage

gt_theme_almanac(
  gt_object,
  accent = "#8C2F1E",
  density = c("compact", "comfortable", "social"),
  stripe = "#F1F1EF",
  ...
)

Arguments

gt_object

A gt table object to modify.

accent

Character. A hex color for the row-group labels and the rule above the table. Defaults to "#8C2F1E".

density

Character. The type and padding scale. One of "comfortable", "compact", or "social". See Density. Defaults to "compact".

stripe

Character. A hex color for the banded rows. Pass NA to switch banding off and keep the rest of the theme. Defaults to "#F1F1EF".

...

Additional arguments passed to gt::tab_options, applied last so they override anything the theme sets.

Value

Returns a modified gt table with the theme applied.

Details

It is the only theme in the package that bands its rows.

Density

density sets the type and padding scale together. "comfortable" uses a 14px body with roomy rows, "compact" a 12px body with tight rows, and "social" a 17px body with generous rows and a larger title, at the scale gt_save_crop() and gt_social_crop() export at.

Figures

Preview of the almanac theme

Examples

library(gt)
nfc <- subset(
  sdv_example_standings, conference == "NFC",
  c(team_name, wins:points_against)
)
gt(head(nfc, 12)) |> gt_theme_almanac()
team_name wins losses ties win_pct points_for points_against
Philadelphia Eagles 11 6 0 0.647 379 325
Dallas Cowboys 7 9 1 0.441 471 511
Washington Commanders 5 12 0 0.294 356 451
New York Giants 4 13 0 0.235 381 439
Chicago Bears 11 6 0 0.647 441 415
Green Bay Packers 9 7 1 0.559 391 360
Minnesota Vikings 9 8 0 0.529 344 333
Detroit Lions 9 8 0 0.529 481 413
Carolina Panthers 8 9 0 0.471 311 380
Tampa Bay Buccaneers 8 9 0 0.471 380 411
Atlanta Falcons 8 9 0 0.471 353 401
New Orleans Saints 6 11 0 0.353 306 383
# banding off, cooler accent east <- subset( sdv_example_standings, league == "nba" & conference == "Eastern", c(team_name, wins, losses, win_pct:points_against) ) gt(east) |> gt_theme_almanac(stripe = NA, accent = "#1F3A5F")
team_name wins losses win_pct points_for points_against
Boston Celtics 56 26 0.683 9418 8787
New York Knicks 53 29 0.646 9549 9030
Toronto Raptors 46 36 0.561 9400 9168
Philadelphia 76ers 45 37 0.549 9502 9517
Brooklyn Nets 20 62 0.244 8686 9505
Detroit Pistons 60 22 0.732 9657 8988
Cleveland Cavaliers 52 30 0.634 9801 9464
Milwaukee Bucks 32 50 0.390 9072 9581
Chicago Bulls 31 51 0.378 9537 9964
Indiana Pacers 19 63 0.232 9219 9874
Atlanta Hawks 46 36 0.561 9714 9516
Orlando Magic 45 37 0.549 9491 9439
Charlotte Hornets 44 38 0.537 9513 9117
Miami Heat 43 39 0.524 9911 9720
Washington Wizards 17 65 0.207 9258 10240