Closed alanryder closed 3 months ago
Thanks for the note @alanryder. When initially developing the hockey rink (as well as all other surfaces currently supported), I spent a good amount of time debating whether or not to include features that are out of bounds like team bench areas for hockey and football or the substitution area on a basketball court. What I ultimately settled on is that if specifications are provided in the rule books for the given sport, then I'll include the features as a default. As bench specs are provided for most hockey leagues (for example, Rule 3.1 here provides dimensions for NHL benches), I included them as the default behavior.
I'd respectfully push back a bit on these not being useful; I think it depends on the use case. While certain events like hits or passes may not depend on these features' presence, it may eventually be useful if(/hopefully when) tracking data becomes available to demonstrate where these features are by team if not by player, and the package was designed with this in mind. If, for example, you wanted to use {sportyR}
to show play development where a player had just jumped on the ice and received a pass, replace a broken stick, or left the penalty box, it might be of interest to include where those features are in relation to the rest of the play. The off-ice officials box may not fit this description, but given that it's always situated between the benches, it was easier to include than exclude.
I'm also a bit hesitant to add a parameter for these types of features, as the intention/"philosophy" of the rest of the package is uniformity of arguments across sports. This enables myself and anyone else who wishes to contribute to the package to quickly get a new sport set up as well as identify any underlying problems. As not every sport has out-of-bounds features like this, and some have out-of-bounds features that may be important (e.g. behind the baseline of a tennis court, or the 10-foot line extension on a volleyball court where players are regularly out-of-bounds but in play), having this parameter and setting it to FALSE seems like it'd make maintenance harder than needed.
If you'd like the features you note to be effectively hidden, the code below should do the trick:
library(sportyR)
geom_hockey(
league = "nhl",
rink_updates = list(
bench_length = 0,
bench_depth = 0,
bench_separation = 0,
penalty_box_length = 0,
penalty_box_depth = 0,
penalty_box_separation = 0
)
)
library(sportyR)
geom_hockey(
league = "nhl",
display_range = "ozone",
rink_updates = list(
bench_length = 0,
bench_depth = 0,
bench_separation = 0,
penalty_box_length = 0,
penalty_box_depth = 0,
penalty_box_separation = 0
)
)
library(sportyR)
geom_hockey(
league = "nhl",
display_range = "nzone",
rink_updates = list(
bench_length = 0,
bench_depth = 0,
bench_separation = 0,
penalty_box_length = 0,
penalty_box_depth = 0,
penalty_box_separation = 0
)
)
library(sportyR)
geom_hockey(
league = "nhl",
display_range = "dzone",
rink_updates = list(
bench_length = 0,
bench_depth = 0,
bench_separation = 0,
penalty_box_length = 0,
penalty_box_depth = 0,
penalty_box_separation = 0
)
)
I realize that in the full (default) display range and the nzone
display range there is still a small rectangle that appears. There are a few options I can implement relatively quickly, although I'm admittedly a bit hesitant to introduce more parameters as it becomes much more challenging for both myself and users to maintain:
bench_outline_thickness
and penalty_box_outline_thickness
, which may be controlled similarly to the ones I set above. They'll default to the same thickness as the boards, so it'll be up to users to set them to 0 when desired (as well as the features set in the examples above). Current behavior sets the thickness of the outline of the bench and penalty boxes to the same thickness as the boards, which seems appropriate as they're physically the same thickness as the boards at a rinkbench_outline
and penalty_box_outline
. Given the code under the hood here, I'd likely implement the bench_outline
color parameter as being team-dependent while the penalty_box_outline
would be one color for both teams. This would be easy enough to implement relatively quickly, so setting the colors to #ffffff
or NULL
(or whatever color you have set for plot_background
if you've adjusted it via color_updates
) should remove the feature. You'd also need to set the color for the off-ice officials box to the same so it wouldn't showDoes this help? If you'd like me to pursue additional development, do you have a preference of the options above or an alternative idea?
Thanks for the quick and thoughtful response (and thanks even more for the package).
As a hockey guy, I think of the limits of the playing surface as quite black and white. But I can think of counter examples in most other sports. I fully appreciate your goal to have coding frameworks consistent across sports. My view of default behaviour is just mine (for hockey).
My use case is a half rink or offensive/ defensive zone plot. You implement these (including several synonyms for each), but the out-of-bounds objects become a visual distraction as we zoom in. You provide the option of removing these out-of-bounds objects for a full-rink plot, but not when “zoomed in” on parts of the rink. So, this just seems incomplete to me. Perhaps there is a more elegant solution than the one I suggested.
I agree that the code you provided should meet my needs. Don’t go recoding on my account.
Regards,
Alan
From: Ross Drucker @.> Sent: Friday, March 8, 2024 12:15 PM To: sportsdataverse/sportyR @.> Cc: alanryder @.>; Mention @.> Subject: Re: [sportsdataverse/sportyR] geom_hockey plotting of objects outside of the ice surface (Issue #36)
Thanks for the note @alanryder https://github.com/alanryder . When initially developing the hockey rink (as well as all other surfaces currently supported), I spent a good amount of time debating whether or not to include features that are out of bounds like team bench areas for hockey and football or the substitution area on a basketball court. What I ultimately settled on is that if specifications are provided in the rule books for the given sport, then I'll include the features as a default. As bench specs are provided for most hockey leagues (for example, Rule 3.1 here https://media.nhl.com/site/asset/public/ext/2023-24/2023-24Rulebook.pdf provides dimensions for NHL benches), I included them as the default behavior.
I'd respectfully push back a bit on these not being useful; I think it depends on the use case. While certain events like hits or passes may not depend on these features' presence, it may eventually be useful if(/hopefully when) tracking data becomes available to demonstrate where these features are by team if not by player, and the package was designed with this in mind. If, for example, you wanted to use {sportyR} to show play development where a player had just jumped on the ice and received a pass, replace a broken stick, or left the penalty box, it might be of interest to include where those features are in relation to the rest of the play. The off-ice officials box may not fit this description, but given that it's always situated between the benches, it was easier to include than exclude.
I'm also a bit hesitant to add a parameter for these types of features, as the intention/"philosophy" of the rest of the package is uniformity of arguments across sports. This enables myself and anyone else who wishes to contribute to the package to quickly get a new sport set up as well as identify any underlying problems. As not every sport has out-of-bounds features like this, and some have out-of-bounds features that may be important (e.g. behind the baseline of a tennis court, or the 10-foot line extension on a volleyball court where players are regularly out-of-bounds but in play), having this parameter and setting it to FALSE seems like it'd make maintenance harder than needed.
If you'd like the features you note to be effectively hidden, the code below should do the trick:
library(sportyR) geom_hockey( league = "nhl", rink_updates = list( bench_length = 0, bench_depth = 0, bench_separation = 0, penalty_box_length = 0, penalty_box_depth = 0, penalty_box_separation = 0 ) )
library(sportyR) geom_hockey( league = "nhl", display_range = "ozone", rink_updates = list( bench_length = 0, bench_depth = 0, bench_separation = 0, penalty_box_length = 0, penalty_box_depth = 0, penalty_box_separation = 0 ) )
library(sportyR) geom_hockey( league = "nhl", display_range = "nzone", rink_updates = list( bench_length = 0, bench_depth = 0, bench_separation = 0, penalty_box_length = 0, penalty_box_depth = 0, penalty_box_separation = 0 ) )
library(sportyR) geom_hockey( league = "nhl", display_range = "dzone", rink_updates = list( bench_length = 0, bench_depth = 0, bench_separation = 0, penalty_box_length = 0, penalty_box_depth = 0, penalty_box_separation = 0 ) )
I realize that in the full (default) display range and the nzone display range there is still a small rectangle that appears. There are a few options I can implement relatively quickly, although I'm admittedly a bit hesitant to introduce more parameters as it becomes much more challenging for both myself and users to maintain:
Does this help? If you'd like me to pursue additional development, do you have a preference of the options above or an alternative idea?
— Reply to this email directly, https://github.com/sportsdataverse/sportyR/issues/36#issuecomment-1986357297 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/AB57OMH24CBSP2ECY35SIH3YXIL4JAVCNFSM6AAAAABENJBZGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWGM2TOMRZG4 unsubscribe. You are receiving this because you were mentioned. https://github.com/notifications/beacon/AB57OMEICLSLKS5JDJT224LYXIL4JA5CNFSM6AAAAABENJBZGWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTWMVUDC.gif Message ID: < @.> @.>
The plotting of player benches, penalty boxes, and the off-ice officials box are not very useful and should not be the default behaviour. These can be suppressed only for the full rink only by setting the display_range parameter to "in bounds only". There is no option to exclude these out of bounds objects from the offensive, neutral, and defensive zone plots. I think it would be better to add these out of bounds objects based on a boolean parameter (which should default to FALSE).