Skip to contents

Replaces a categorical axis's tick labels with team logos.

Usage

sdv_axis_logos(
  p,
  teams,
  league,
  axis = c("x", "y"),
  size = 0.08,
  season = NULL,
  variant = "default",
  id_system = "auto",
  strict = FALSE
)

Arguments

p

A plotly object.

teams

The axis categories, in the chart's order (the team values the chart plots on that axis).

league

A league key from sdv_leagues(). Required: one abbreviation means different teams in different leagues.

axis

"x" or "y".

size

Image size as a fraction of the plot area on the other axis.

season

NULL for today's mark, or a season (or one per team): the mark the team wore that season where the archive dates its marks.

variant

"default", "dark", or a named variant from sdv_marks() ("scoreboard", "grayscale", "cap_on_light", ...). A team without it gets its closest mark of the same polarity; a name no mark in the archive has is an error listing the league's variants.

id_system

For headshots, as in sdv_headshot_url().

strict

If TRUE, a value that does not resolve is an error; otherwise it becomes NA with one warning per call.

Value

The plotly object (an htmlwidget).

Examples

# \donttest{
if (requireNamespace("plotly", quietly = TRUE)) {
  teams <- c("KC", "BUF", "BAL")
  plotly::plot_ly(x = teams, y = c(11, 13, 12), type = "bar") |>
    sdv_axis_logos(teams, "nfl")
}
# }