get_surface_dimensions(sport, league = NULL) returns
the rule-book parameters the geom_*() functions draw from,
for one league or every league of a sport, so other packages no longer
need to read the internal surface_dimensions (#73)geom_lacrosse(): the NLL and World Lacrosse neutral
zones now span the 85 ft between the restraining lines; the zones read a
key the data did not have, so the neutral zone was always 0 long (#60)geom_lacrosse(): the NLL and World Lacrosse penalty box
fills now start at the inside edge of the boards; their anchor read
board_thickness instead of boards_thickness
(#61)geom_lacrosse(): the goal-fan hash marks (NCAA and USA
Lacrosse women’s) are now placed at the angle they are rotated by, so
each sits on the fan arc, perpendicular to it, at its stated distance
along the arc; they were placed s / goal_fan_radius but
rotated s / (goal_fan_radius + goal_circle_radius) radians
from the centre mark (#62)geom_lacrosse(): display_range = "full"
(and the half-field ranges) now take in the NLL and World Lacrosse
player benches, penalty boxes and off-field officials’ box, whose outer
0.5 ft was cut off by a range that stopped at the apron (#63)geom_lacrosse(): goal_arc_line_thickness
now defaults to 0 like every other feature argument; a goal arc added
through field_updates without a thickness was drawn as a
solid block (#64)geom_lacrosse(): a center_face_off_marker
colour passed in color_updates is kept; the contrasting
default (#ffcb05, NCAA men’s) is applied only when the user
did not choose a colour and the marker would match the centre line. This
also means that recolouring only center_line now stops the
yellow contrast default from applying: the marker keeps its default
white (#65)restricted_area_width is now 1.8889 yd,
so the coaching line sits six feet outside the sideline (measured from
its inside edge) and the limit line twelve feet out, per NCAA Football
Rules 1-2-2, 1-2-3-a and 1-2-4-a; it was 1.3333 yd, which put the
coaching line 4.33 ft out (#66)geom_lacrosse(): the NCAA and USA Lacrosse women’s
8-meter arc now follows NCAA Women’s Lacrosse Rule 1, Sections 6-7: an
arc of 10.6 m about the centre of the goal line, ending on 45-degree
lines from where the goal line extended crosses the goal circle (it was
a 13.2 m arc about a point behind the goal line). Its hash marks sit on
that circle, the 12 m marks past the painted arc as in the rule book’s
Diagram 2, and the two marks on the goal line extended are 30.5 cm long
(were 0.4058 m). Leagues without a goal fan no longer draw a hidden,
zero-size fan polygon (the picture is unchanged), and
geom_lacrosse("custom") now draws instead of failing with
“‘from’ must be a finite number” (#69)geom_lacrosse(): the PLL two-point arc now follows the
2024 PLL Rulebook (II. The Field, G): its lines run parallel to the
sidelines 13 yd from the centre of the goal line, from the end line
until they are 15 yd from it, joined by a 15 yd arc; it was a 15 yd
semicircle with its lines 15 yd out. New surface_dimensions
key goal_arc_parallel_line_to_center (PLL: 13 yd); without
it the arc stays a semicircle (#70)geom_lacrosse(): each NLL and World Lacrosse penalty
box is now penalty_box_length (8 ft) inside, its outer wall
moved out by one wall thickness (0.25 ft); it was 7.75 ft inside. The 24
ft of NLL Rule 8.1 is read as the sum of the three interiors (two
penalty boxes and the officials’ box), as for the benches (#72)geom_baseball(), geom_basketball(),
geom_curling(), geom_football(),
geom_hockey(), geom_lacrosse(),
geom_soccer(), geom_tennis() and
geom_volleyball(): drawing in other units
(field_units, court_units,
rink_units, pitch_units,
sheet_units) now scales the features’ positions (including
the football yardage numbers) and the display range along with their
shapes. Before, the shapes were converted but placed with unconverted
anchors, and the plot limits stayed in the rule book’s units.
x_trans, y_trans, xlims and
ylims are in the requested units, as before
(geom_softball() already handled this) (#74)geom_lacrosse(): the women’s 8-meter-arc hash marks are
now centred on the middle of the arc’s line
(goal_fan_radius - goal_fan_line_thickness / 2), so they
bisect it as NCAA Women’s Lacrosse Rule 1, Section 7 requires; they
straddled the line’s outer edge (#75)geom_football(): the invisible bounding box drawn with
each yardage number is no longer translated twice by
x_trans / y_trans; it moved by double the
translation, away from its number (#76)custom surface in other units
(e.g. geom_lacrosse("custom", field_units = "m")) now
explains that custom surfaces have no rule-book units and how to set
them, instead of failing with “’ is not a viable unit at this
time.’”geom_basketball("custom") now draws: the custom
template’s empty JSON arrays arrive as list(), which
%or% could not handle (it now falls back to the default for
any zero-length value) and which the lane and display-range code read
directly (#77)geom_lacrosse() example now uses a lacrosse league
("NLL") instead of the volleyball league
"FIVB"field_bordered is now read; NCAA, NFHS and
NFL draw a white border outline by default; CFL is unchanged.
field_bordered is now true for NCAA, NFHS
(11/9/8/6) and NFL, and bordered fields default
field_border_outline and
red_zone_border_outline to #ffffff (otherwise
transparent #ffffff00); a colour passed in
color_updates always wins (#67)citation("sportyR")) and a
softball example to the introductory vignetteskip_on_cran()geom_softball(), along with the internal
softball_*() feature functions,
softball_features_set_colors(), and "softball"
entries in surface_dimensionsr-devel{ggplot2} now works as expected (#27, @mrcaseb)Re-aligned switch() statements to have condition and
cases with matching indentation to improve readability
Updated syntax in geom_football() to avoid tidy
syntax deprecation warning
Added load_default_parameters() function for faster
debugging internally. This function allows all defaults of a particular
geom_{sport}() function to be loaded and set as environment
variables rather than having to set each one individually
Updated data-raw/internal-datasets.R
to clear environment and reload current version of package upon sourcing
for debugging
Fixed #14. Issue with volleyball documentation
Fixed #15. All outline colors are respected
Added red zone border and border outline to football fields
Changed default coloring of football field border outline
Fixed issue with field border thickness when plotting behind the bench
Fixed #18. Can now constrain all plots to only display in-bound playing area (plus sidelines)
Corrected football field layering to work better with hex-alpha color specifications (layering of colors previously caused issues)
Renamed files to use - (hyphen) instead of
_ (underscore) across package
New function, is_hex(), checks if a value is valid
hexadecimal (relates to #15)
Animating Tracking Data vignette now uses images hosted on GitHub to avoid the need to render at run time
Fixed #8. All display ranges for hockey rinks work as expected
Fixed #9.
Yardage markers now move responsive to x_trans and
y_trans
Added gifski package as Suggests-level
dependency so gifs in vignettes may render properly
Changed logic into how curling ends are drawn/placed on a curling sheet
Adjusted xlims for geom_hockey() to
include slightly more of the neutral zone when using
display_range %in% c("ozone", "dzone")
Updated licensing to GPL >= 3
Changed website colors
Re-defined all surfaces to be parameterized by the size of their features, rather than being defined individually in a file
New internal data set
(data-raw/surface_dimensions.json) to maintain all league
dimensions
Removal of data-raw/sport_lookup.json and
data-raw/league_lookup.json files (replaced by
data-raw/surface_dimensions.json)
Updated styling conventions to match tidyverse style guide with the
sole exception being the use of explicit return()
statements
Updated file naming convention to be easier to group feature
files and geom_{sport}() files
Updated documentation
Introduction of the display_range parameter to allow
customized views of plots (e.g. only seeing the red zone of a football
field, rather than the entire field)
Introduction of the {surface}_updates parameter to
allow customization of a surface starting at a base surface
(e.g. geom_hockey("NHL", surface_updates = list(rink_length = 400)))
will create a regulation NHL ice rink that is twice as long as it should
be. This allows the package to better handle edge cases and support more
users off the bat with less internal maintenance
Introduction of the color_updates parameter to allow
colors of features to change more easily and explicitly internally in
the code
Introduction of x_trans and y_trans
argument for every surface to adjust positioning of origin
Removed full_surf and rotation_dir
arguments to allow for display_range and more flexible
rotation arguments to be introduced. The improved argument
structure will allow for more granular “zoom” on plots to regions of
interest, as well as adjusting coordinates appropriately to match data
sets
Removed vdiffr tests as these were becoming
unmanageable and didn’t scale well to new leagues. Additionally, should
a league change its dimension requirements, the case itself is no longer
valid despite the league’s plot requiring the change. Instead,
the individual plotting functions are checked as well as the classes of
the resulting plots
Removed requirement to include a plot caption color (fixes #3)
On September 7, 2021, the NWHL changed names to be the PHF. This name change is now reflected in the package, with NWHL still valid so as to be backwards compatible.
rotation_dir = TRUE to
rotation_dir = "ccw")ft (reordered geom_ncaa_hockey() code to
adjust units before plotting)tests/testthat/test-plot-functions.R to more closely
resemble rest of repository structure. Plots now tested by sport rather
than by plot-specific feature (e.g. units or rotation)Initial release! Ability to plot baseball, basketball ((W)NBA, NCAA, and FIBA), football (NFL and NCAA), hockey ((W)NHL, IIHF, NCAA), and soccer (FIFA, MLS, NCAA, NWSL, and Premier League) is included, with the capability to customize outputs in specific colors.