nba_travel_plot: NBB Flight Paths

View source: R/NBA_travel_plot.R

nba_travel_plotR Documentation

NBB Flight Paths

Description

Plots the estimated flight paths for the selected season and team(s). It returns a ggplot object that can be further customized by the user.

Usage

nba_travel_plot(
  data,
  season = NULL,
  team = NULL,
  land_color = "#17202a",
  land_alpha = 0.6,
  city_color = "cyan4",
  city_size = 0.8,
  path_curvature = 0.05,
  path_color = "#e8175d",
  path_size = 0.5,
  title = "NBA Flight Paths",
  title_color = "white",
  title_size = 20,
  caption = "",
  caption_color = "gray",
  caption_size = 8,
  caption_face = "italic",
  major_grid_color = "transparent",
  minor_grid_color = "transparent",
  strip_text_size = 8,
  strip_text_color = "white",
  strip_fill = "transparent",
  plot_background_fill = "#343e48",
  panel_background_fill = "transparent",
  ncolumns = 6
)

Arguments

data

A data frame. The result of nba_travel()

season

Numeric. A four year digit (i.e. 2018). If not indicated it defaults to the most recent season in the dataset.

team

A character string. The name of a team (or vector of teams) to display. If not indicated it will default to all teams.

land_color

A character string. Color of the land.

land_alpha

Numeric. The alpha value of the land between 0-1. Used to set transparecy level.

city_color

A character String. The color of the points representing the cities.

city_size

Numeric. The size of the point representing the cities.

path_curvature

Numeric. The level of curvature for the path representing the flight. Defaults to 0.05.

path_color

A character String. The color of the lines representing the flight path.

path_size

Numeric. The thickness of the lines representing the flight paths. Defaults to 0.5.

title

A character string. The plot title.

title_color

A character string. The color of the title text.

title_size

Numeric. The size of the title text. Defaults to 20.

caption

A character string. The plot caption.

caption_color

A character string. The color of the caption text.

caption_size

Numeric. The size of the caption text. Defaults to 8.

caption_face

A character string. TThe face of the caption text. Defaults to "italic".

major_grid_color

A character string. The color of the major gridlines. Defaults to "transparent".

minor_grid_color

A character string. The color of the minor gridlines. Defaults to "transparent".

strip_text_size

Numeric. The size of the strip text. Default to 8.

strip_text_color

A character string. The color of the strip text.

strip_fill

A character string. The color of the strip. Defaults to "transparent.

plot_background_fill

A character string. The color of the plot background.

panel_background_fill

A character string. The color of the panel background.

ncolumns

Numeric. The number of columns for facetted plots.

Value

A ggplot object

Examples

datos <- nba_travel(start_season = 2015, end_season = 2018)
nba_travel_plot(data = datos,
                season = 2017,
                team = c("Chicago Bulls", "Miami Heat"),
                city_color = "white",
                plot_background_fill = "black",
                land_color = "gray",
                caption_color = "lightblue",
                ncolumns = 1)


josedv82/airball documentation built on June 27, 2023, 2:51 p.m.