Skip to content

Commit

Permalink
gt article column spanners
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Dec 13, 2024
1 parent ffc2faa commit 57e7d84
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions vignettes/articles/gt.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,35 @@ example_table |>
nflplotR::gt_nfl_wordmarks(locations = gt::cells_stub())
```

### Column Spanners

We use another table to demonstrate how to convert team names to logos and wordmarks in column spanners.

Here only logos

```{r}
df <- data.frame(a = 3, b = 4, c = 5, d = 6)
df |>
gt::gt() |>
gt::tab_spanner("KC", c(a, b)) |>
gt::tab_spanner("LAC", c(c, d)) |>
nflplotR::gt_nfl_logos(locations = gt::cells_column_spanners())
```

And now mix logo and wordmark

```{r}
df <- data.frame(a = 3, b = 4, c = 5, d = 6)
df |>
gt::gt() |>
gt::tab_spanner("KC", c(a, b)) |>
gt::tab_spanner("LAC", c(c, d)) |>
nflplotR::gt_nfl_logos(locations = gt::cells_column_spanners("KC")) |>
nflplotR::gt_nfl_wordmarks(locations = gt::cells_column_spanners("LAC"))
```

### Combine all together

The `locations` argument allows multiple locations in one call by wrapping them in a list.
Expand Down

0 comments on commit 57e7d84

Please sign in to comment.