sportsdataverse / fastRhockey

Boxscore and play-by-play stat scraper for the Premier Hockey Federation (PHF, formerly known as the NWHL).
https://fastRhockey.sportsdataverse.org
Other
21 stars 3 forks source link

Shot coordinates #40

Open walinchus opened 5 months ago

walinchus commented 5 months ago

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?

benhowell71 commented 5 months ago

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

walinchus commented 5 months ago

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_coordof 100 and ay_coord of 42.5. The x_coord_originalvalue 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?