sportyR 2.4.0
New Functions
-
get_surface_dimensions(sport, league = NULL)returns the rule-book parameters thegeom_*()functions draw from, for one league or every league of a sport, so other packages no longer need to read the internalsurface_dimensions(#73)
Patches/Bug Fixes
-
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 readboard_thicknessinstead ofboards_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 placeds / goal_fan_radiusbut rotateds / (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_thicknessnow defaults to 0 like every other feature argument; a goal arc added throughfield_updateswithout a thickness was drawn as a solid block (#64) -
geom_lacrosse(): acenter_face_off_markercolour passed incolor_updatesis 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 onlycenter_linenow stops the yellow contrast default from applying: the marker keeps its default white (#65) - NCAA football:
restricted_area_widthis 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), andgeom_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. Newsurface_dimensionskeygoal_arc_parallel_line_to_center(PLL: 13 yd); without it the arc stays a semicircle (#70) - NFL football: where the field border, its outline and the apron wrap round the trapezoid team bench, their outer corner now follows the bench’s slanted side (19.15 yd from centre, was 19.41 yd), as the 2026 NFL Rulebook’s bench-area diagram draws the line behind the bench parallel to it. The branch for slanted benches had been applied to rectangular ones and vice versa; NCAA, NFHS and CFL are unchanged (#71)
-
geom_lacrosse(): each NLL and World Lacrosse penalty box is nowpenalty_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()andgeom_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,xlimsandylimsare 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 byx_trans/y_trans; it moved by double the translation, away from its number (#76) - Drawing a
customsurface 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 aslist(), 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) - The
geom_lacrosse()example now uses a lacrosse league ("NLL") instead of the volleyball league"FIVB"
Changed output
- football:
field_borderedis now read; NCAA, NFHS and NFL draw a white border outline by default; CFL is unchanged.field_borderedis nowtruefor NCAA, NFHS (11/9/8/6) and NFL, and bordered fields defaultfield_border_outlineandred_zone_border_outlineto#ffffff(otherwise transparent#ffffff00); a colour passed incolor_updatesalways wins (#67)
sportyR 2.3.0
New Sports and Leagues Supported
Softball
- NCAA (per the NCAA Softball Rules, Rule 2: Field of Play)
- Added
geom_softball(), along with the internalsoftball_*()feature functions,softball_features_set_colors(), and"softball"entries insurface_dimensions - Softball support contributed by Billy Fryer (@wwfryer, #52)
sportyR 2.2.2
CRAN release: 2024-02-15
- Fixed #32 with plot titles not displaying correctly
- Updating documentation per CRAN notes on
r-devel
sportyR 2.2.0
Patches/Bug Fixes
- Fixed #24. Invalid league errors should now be more explicit
Internal Changes
Re-aligned
switch()statements to have condition and cases with matching indentation to improve readabilityUpdated syntax in
geom_football()to avoid tidy syntax deprecation warningAdded
load_default_parameters()function for faster debugging internally. This function allows all defaults of a particulargeom_{sport}()function to be loaded and set as environment variables rather than having to set each one individuallyUpdated
data-raw/internal-datasets.Rto clear environment and reload current version of package upon sourcing for debugging
sportyR 2.1.0
CRAN release: 2022-10-31
Patches/Bug Fixes
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)
Internal Changes
Renamed files to use
-(hyphen) instead of_(underscore) across packageNew 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
sportyR 2.0.1
CRAN release: 2022-09-24
Intenal Changes
Changed logic into how curling ends are drawn/placed on a curling sheet
Adjusted
xlimsforgeom_hockey()to include slightly more of the neutral zone when usingdisplay_range %in% c("ozone", "dzone")Updated licensing to GPL >= 3
Changed website colors
sportyR 2.0.0
CRAN release: 2022-08-15
Internal Changes
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 dimensionsRemoval of
data-raw/sport_lookup.jsonanddata-raw/league_lookup.jsonfiles (replaced bydata-raw/surface_dimensions.json)Updated styling conventions to match tidyverse style guide with the sole exception being the use of explicit
return()statementsUpdated file naming convention to be easier to group feature files and
geom_{sport}()filesUpdated documentation
Additional Capabilities
Introduction of the
display_rangeparameter 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}_updatesparameter 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 maintenanceIntroduction of the
color_updatesparameter to allow colors of features to change more easily and explicitly internally in the codeIntroduction of
x_transandy_transargument for every surface to adjust positioning of origin
Breaking Changes (and justifications for breaks)
Removed
full_surfandrotation_dirarguments to allow fordisplay_rangeand more flexiblerotationarguments 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 setsRemoved
vdiffrtests 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
sportyR 1.0.4
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.
sportyR 1.0.3
- Added tennis plotting capability
- Fixed issue with NCAA football plot hash marks (initially typed as 6, should have been typed as 60)
- Fixed minor bug with all soccer plots (changed
rotation_dir = TRUEtorotation_dir = "ccw") - Fixed minor bug in NCAA hockey plots when plotting in units other than
ft(reorderedgeom_ncaa_hockey()code to adjust units before plotting) - Restructured code in
tests/testthat/test-plot-functions.Rto more closely resemble rest of repository structure. Plots now tested by sport rather than by plot-specific feature (e.g. units or rotation) - Fixed minor bug with converting between millimeters and feet (originally was specified as 3048mm per foot, corrected to 304.8mm per foot)
sportyR 1.0.0
CRAN release: 2021-04-19
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.
