Title: | Plot Scaled 'ggplot' Representations of Sports Playing Surfaces |
---|---|
Description: | Create scaled 'ggplot' representations of playing surfaces. Playing surfaces are drawn pursuant to rule-book specifications. This package should be used as a baseline plot for displaying any type of tracking data. |
Authors: | Ross Drucker [aut, cre] |
Maintainer: | Ross Drucker <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.2.3 |
Built: | 2025-02-03 08:28:09 UTC |
Source: | https://github.com/sportsdataverse/sportyr |
Check to see what features of a surface can be colored
cani_color_league_features(league_code, sport_name = NULL)
cani_color_league_features(league_code, sport_name = NULL)
league_code |
The case-insensitive league code to be plotted |
sport_name |
The name of a sport to use in the event that the
|
Nothing, but a message is sent to the console
cani_color_league_features("NCAA", "basketball")
cani_color_league_features("NCAA", "basketball")
Check to see if a league can be plotted, and alert as to which function(s) that league will work for
cani_plot_league(league_code)
cani_plot_league(league_code)
league_code |
The case-insensitive league code to be plotted |
Nothing, but a message is sent to the console
cani_plot_league("MLB")
cani_plot_league("MLB")
Check to see if a sport can be plotted, and alert as to which league(s) are plottable for the sport
cani_plot_sport(sport_code)
cani_plot_sport(sport_code)
sport_code |
The case-insensitive sport name |
Nothing, but a message is sent to the console
cani_plot_sport("basketball")
cani_plot_sport("basketball")
Convert all units, regardless of starting and ending units
convert_units(meas, from_unit, to_unit, conversion_columns = NULL)
convert_units(meas, from_unit, to_unit, conversion_columns = NULL)
meas |
A measurement in any unit of length |
from_unit |
A string containing the original unit of measure to be converted |
to_unit |
A string containing the ending unit of measure |
conversion_columns |
A vector containing the columns to convert if
|
The measurement in converted units
convert_units(1, "in", "cm") convert_units(100, "cm", "m")
convert_units(1, "in", "cm") convert_units(100, "cm", "m")
ggplot2
instance containing a baseball field for a
specified leagueGenerate a ggplot2
instance containing a baseball field for a
specified league
geom_baseball( league, display_range = "full", field_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, field_units = NULL, xlims = NULL, ylims = NULL )
geom_baseball( league, display_range = "full", field_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, field_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
field_updates |
A list of updates to the field's parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the field's default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
field_units |
The units with which to draw the field. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
baseball field
## Not run: geom_baseball(league = "MLB", rotation = 270, display_range = "infield") geom_baseball(league = "little league", field_units = "m") ## End(Not run)
## Not run: geom_baseball(league = "MLB", rotation = 270, display_range = "infield") geom_baseball(league = "little league", field_units = "m") ## End(Not run)
ggplot2
instance containing a basketball court for a
specified leagueGenerate a ggplot2
instance containing a basketball court for a
specified league
geom_basketball( league, display_range = "full", court_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, court_units = NULL, xlims = NULL, ylims = NULL )
geom_basketball( league, display_range = "full", court_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, court_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
court_updates |
A list of updates to the courts' parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the courts' default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
court_units |
The units with which to draw the court. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
basketball court
## Not run: geom_basketball(league = "NBA", rotation = 270, display_range = "offense") geom_basketball(league = "fiba", court_units = "ft") ## End(Not run)
## Not run: geom_basketball(league = "NBA", rotation = 270, display_range = "offense") geom_basketball(league = "fiba", court_units = "ft") ## End(Not run)
ggplot2
instance containing a curling sheet for a specified
leagueGenerate a ggplot2
instance containing a curling sheet for a specified
league
geom_curling( league, display_range = "full", sheet_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, sheet_units = NULL, xlims = NULL, ylims = NULL )
geom_curling( league, display_range = "full", sheet_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, sheet_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
sheet_updates |
A list of updates to the sheet's parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the sheet's default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
sheet_units |
The units with which to draw the sheet. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
curling sheet
## Not run: geom_curling(league = "wcf", rotation = 270, display_range = "house") geom_curling(league = "wcf", sheet_units = "ft") ## End(Not run)
## Not run: geom_curling(league = "wcf", rotation = 270, display_range = "house") geom_curling(league = "wcf", sheet_units = "ft") ## End(Not run)
ggplot2
instance containing a football field for a
specified leagueGenerate a ggplot2
instance containing a football field for a
specified league
geom_football( league, display_range = "full", field_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, field_units = NULL, xlims = NULL, ylims = NULL )
geom_football( league, display_range = "full", field_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, field_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
field_updates |
A list of updates to the field's parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the field's default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
field_units |
The units with which to draw the field. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
football field
## Not run: geom_football(league = "NFL", rotation = 270, display_range = "red_zone") geom_football(league = "cfl", field_units = "ft") ## End(Not run)
## Not run: geom_football(league = "NFL", rotation = 270, display_range = "red_zone") geom_football(league = "cfl", field_units = "ft") ## End(Not run)
ggplot2
instance containing an ice rink for a specified
leagueGenerate a ggplot2
instance containing an ice rink for a specified
league
geom_hockey( league, display_range = "full", rink_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, rink_units = NULL, xlims = NULL, ylims = NULL )
geom_hockey( league, display_range = "full", rink_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, rink_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
rink_updates |
A list of updates to the rink's parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the courts' default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
rink_units |
The units with which to draw the rink. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of an
ice hockey rink
## Not run: geom_hockey(league = "NHL", rotation = 270, display_range = "ozone") geom_hockey(league = "iihf", rink_units = "ft") ## End(Not run)
## Not run: geom_hockey(league = "NHL", rotation = 270, display_range = "ozone") geom_hockey(league = "iihf", rink_units = "ft") ## End(Not run)
ggplot2
instance containing a lacrosse field for a
specified leagueGenerate a ggplot2
instance containing a lacrosse field for a
specified league
geom_lacrosse( league, display_range = "full", field_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, field_units = NULL, xlims = NULL, ylims = NULL )
geom_lacrosse( league, display_range = "full", field_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, field_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
field_updates |
A list of updates to the fields' parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the fields' default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
field_units |
The units with which to draw the field. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
lacrosse field
## Not run: geom_lacrosse(league = "NCAA", rotation = 270, display_range = "offense") geom_lacrosse(league = "FIVB", field_units = "ft") ## End(Not run)
## Not run: geom_lacrosse(league = "NCAA", rotation = 270, display_range = "offense") geom_lacrosse(league = "FIVB", field_units = "ft") ## End(Not run)
ggplot2
instance containing a soccer pitch for a specified
leagueGenerate a ggplot2
instance containing a soccer pitch for a specified
league
geom_soccer( league, display_range = "full", pitch_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, pitch_units = NULL, xlims = NULL, ylims = NULL )
geom_soccer( league, display_range = "full", pitch_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, pitch_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
pitch_updates |
A list of updates to the pitch's parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the pitch's default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
pitch_units |
The units with which to draw the pitch. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
soccer pitch
## Not run: geom_soccer(league = "EPL", rotation = 270, display_range = "offense") geom_soccer(league = "fifa", pitch_units = "ft") ## End(Not run)
## Not run: geom_soccer(league = "EPL", rotation = 270, display_range = "offense") geom_soccer(league = "fifa", pitch_units = "ft") ## End(Not run)
ggplot2
instance containing a tennis court for a specified
leagueGenerate a ggplot2
instance containing a tennis court for a specified
league
geom_tennis( league, display_range = "full", court_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, court_units = NULL, xlims = NULL, ylims = NULL )
geom_tennis( league, display_range = "full", court_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, court_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
court_updates |
A list of updates to the courts' parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the courts' default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
court_units |
The units with which to draw the court. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
tennis court
## Not run: geom_tennis(league = "USTA", rotation = 270, display_range = "serving") geom_tennis(league = "itf", court_units = "m") ## End(Not run)
## Not run: geom_tennis(league = "USTA", rotation = 270, display_range = "serving") geom_tennis(league = "itf", court_units = "m") ## End(Not run)
ggplot2
instance containing a volleyball court for a
specified leagueGenerate a ggplot2
instance containing a volleyball court for a
specified league
geom_volleyball( league, display_range = "full", court_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, court_units = NULL, xlims = NULL, ylims = NULL )
geom_volleyball( league, display_range = "full", court_updates = list(), color_updates = list(), rotation = 0, x_trans = 0, y_trans = 0, court_units = NULL, xlims = NULL, ylims = NULL )
league |
The league for which to draw the surface. This is case-insensitive |
display_range |
A case-insensitive string indicating the display range
to use for the plot. The default is The possible display ranges are:
|
court_updates |
A list of updates to the courts' parameters. These will overwrite the parameters of the league |
color_updates |
A list of updates to the courts' default colors, which
are set by |
rotation |
An angle, given in degrees, through which the plot should be rotated |
x_trans |
The amount that the |
y_trans |
The amount that the |
court_units |
The units with which to draw the court. The default is
|
xlims |
The limits on the final display in the |
ylims |
The limits on the final display in the |
A ggplot2
instance with a full-surface representation of a
volleyball court
## Not run: geom_volleyball(league = "NCAA", rotation = 270, display_range = "offense") geom_volleyball(league = "FIVB", court_units = "ft") ## End(Not run)
## Not run: geom_volleyball(league = "NCAA", rotation = 270, display_range = "offense") geom_volleyball(league = "FIVB", court_units = "ft") ## End(Not run)