fastRhockey icon indicating copy to clipboard operation
fastRhockey copied to clipboard

Shot coordinates

Open walinchus opened this issue 1 year ago • 2 comments

Question about the event coordinates.

For some reason, when I map them out, I only see a few shots in the top right corner:

image

I tried to go on the PWHL website, but I couldn't find, even using view source, the coordinates of each shot to see if I could adjust them: image

Is there any documentation on the shot coordinates? Like where they are supposed to start from, what's the units, etc?

walinchus avatar Feb 27 '24 20:02 walinchus

the PWHL coordinate system is extremely weird. New update was pushed to fastRhockey tonight to translate the coordinates into a more traditional system.

  • x/y_coord are the traditional points that should be plotable on the geom_hockey rink
  • the other coordinates are either the original or extra flipped versions that I plan to use for some stuff. They are outlined here: https://github.com/sportsdataverse/fastRhockey/pull/41#issue-2160241389

benhowell71 avatar Feb 29 '24 02:02 benhowell71

Thank you for doing this. Is there a coordinate system that you are setting it to? I tried to plot it but it still came out a bit up and to the right, no matter if I used x/ycoord, x/y_coord_original, x/y_coord_fixed, or x/y_coord right.

I think this is the issue: geom_hockey has (0,0) as thevery middle faceoff dot. So any play with a negative X value is on the TV left half of the ice and any with a positive X value is on the TV right half. But the opening faceoff has an x_coord of 100 and a y_coord of 42.5. The x_coord_original value is 300 and they_coord_originalvalue is 150.

Now that I know how to translate them, I can recalculate, but that might be something to think about for this in the future. I'm using the sportyR package to get the geom_hockey() function. Maybe there's another function that does rinks?

walinchus avatar Mar 04 '24 17:03 walinchus