gt-extras
  • Get Started
  • API Reference
  1. Themes
  2. gt_theme_538
  • API Reference
  • Plotting
    • gt_plt_bar
    • gt_plt_dot
    • gt_plt_conf_int
  • Colors
    • gt_highlight_cols
    • gt_hulk_col_numeric
    • gt_color_box
  • Themes
    • gt_theme_538
    • gt_theme_espn
    • gt_theme_guardian
    • gt_theme_nytimes
    • gt_theme_excel
    • gt_theme_dot_matrix
    • gt_theme_dark
    • gt_theme_pff
  • Icons and Images
    • fa_icon_repeat
    • gt_fa_rating
  • HTML Helpers
    • gt_hyperlink
    • with_tooltip

On this page

  • Parameters
  • Returns
  • Examples
  1. Themes
  2. gt_theme_538

gt_theme_538

gt_theme_538(gt)

Applies a FiveThirtyEight-inspired theme to a GT object.

This function styles a GT object with a look inspired by the FiveThirtyEight (538) website.

Parameters

gt : GT

An existing GT object.

Returns

: GT

The themed GT object, allowing for method chaining.

Examples

from great_tables import GT, md
from great_tables.data import gtcars
import gt_extras as gte

gtcars_mini = gtcars[["model", "year", "hp", "trq"]].head(5)

gt = (
    GT(gtcars_mini, rowname_col="model")
    .tab_stubhead(label=md("*Car*"))
    .tab_header(title="Car Collection")
)

gt.pipe(gte.gt_theme_538)
Car Collection
Car year hp trq
GT 2017 647.0 550.0
458 Speciale 2015 597.0 398.0
458 Spider 2015 562.0 398.0
458 Italia 2014 562.0 398.0
488 GTB 2016 661.0 561.0
gt_color_box
gt_theme_espn