Closed MaundoJako closed 1 year ago
Hey! So the main thing is that the default data_type
in all our event data functions is set to statsbomb. Since your data is from opta, you would need to set it as such. Adding in a data_type = "opta"
within the function should do the trick.
Hey, I thought this originally. Though, still doesn't work i'm afraid.
This is the outcome:
CODE: plotting_data_gayle <- plotting_data %>% filter(type.name == "Pass" & team.name == "Stoke City" & player.name == "Dwight Gayle") passPlot <- plot_pass(data_type = "opta", data = plotting_data_gayle, progressive_pass = FALSE, type = "all") passPlot
The plot_passnet
error can be resolved by running the following code.
data <- readxl::read_xlsx("stoke.vs.boro.xlsx")
data <- data %>%
rename("finalX" = "endX",
"finalY" = "endY",
"type" = "type/displayName",
"outcome" = "outcomeType/displayName")
data %>%
filter(match_id == 1) %>%
plot_passnet(team_name = "Stoke City", data_type = "opta")
Will get back to you shortly for the plot_pass
error
Found the error in the plot_pass
source code. A fix will be pushed shortly
What was the issue in the plot_pass code @harshkrishna17
Is it flipped / reversed?
@MaundoJako I am working on the fix for plot_pass(). Can you confirm for us that the others, passflow, convex, and voronoi, are working correctly when you set it to Opta?
Seem to have found the error - so in our pitch plots, we convert all data types to one final data type when showing the plot - that type is StatsBomb.
Looks like there is an error w converting Opta to Statsbomb
@MaundoJako I am working on the fix for plot_pass(). Can you confirm for us that the others, passflow, convex, and voronoi, are working correctly when you set it to Opta?
Hey, Convex works fine. plot_passflow() doesnt work, and I dont think pass_sonar() is working either. Have not tried voronoi yet.
@MaundoJako I am working on the fix for plot_pass(). Can you confirm for us that the others, passflow, convex, and voronoi, are working correctly when you set it to Opta?
Hey, Convex works fine. plot_passflow() doesnt work, and I dont think pass_sonar() is working either. Have not tried voronoi yet.
Can you show us the results for passflow and pass_sonar? They should work as they pretty straightword functions
Opta dataset with plot_pass function
OP's code
Seems like the issue is fixed - if I can get what's wrong with the others, the fix should be similar but I want to double check
Im not sure if the pass_sonar is incorrect, just my eye test thinks it might be. Looking at the picture below, I feel like should be more forward passes shown in the sonar.
Im not sure if the pass_sonar is incorrect, just my eye test thinks it might be. Looking at the picture below, I feel like should be more forward passes shown in the sonar.
Hmm, I actually think it summarize it well. It's not directly forward well but if you look, there is an arrow that is very long that is slightly angled to the left and forward - I feel like the congestion of the passes doesn't allow us to see the direction of the pass therefore why it seem off?
Try it on several players - that's how I tested plot_sonar
For pass_flow, similar explanation as before. I think it might just be flipped? I can solve this issue by scale_y_reverse, look below.
For pass_flow, similar explanation as before. I think it might just be flipped? I can solve this issue by scale_y_reverse, look below.
![]()
![]()
yeah ill double check this but that seems to be it too
you said you had problems with voronoi as well - is it the same issue? flipped
Havent tried voronoi yet. Ill let you know if I have any problems.
For the heatmap(), I dont get any result, just a blank football pitch. Im not sure if this is because Im only plotting from 1 game. In your tutorial you use a season's worth.
what is the code you use for plot_heatmap() ?
Havent tried voronoi yet. Ill let you know if I have any problems.
For the heatmap(), I dont get any result, just a blank football pitch. Im not sure if this is because Im only plotting from 1 game. In your tutorial you use a season's worth.
I am able to get heatmap all fine
Havent tried voronoi yet. Ill let you know if I have any problems. For the heatmap(), I dont get any result, just a blank football pitch. Im not sure if this is because Im only plotting from 1 game. In your tutorial you use a season's worth.
I am able to get heatmap all fine
that too with jdp, density, hex, etc:
Plot_passmap definitely needed the scale_y_reverse:
Functions fixed:
Functions in progress of being fixed:
what is the code you use for plot_heatmap() ?
Apologies, plot_heatmap() is working fine now. I had type = "bin" from the online tutorial: https://abhiamishra.github.io/ggshakeR/articles/Guide_to_Pitch_Plots.html
Works fine with the correct types.
Cheers for your help lads! :)
FYI, voronoi works fine with me
What happened?
I am using code scraped from WhoScored. I have the necessary data, however, the plots return false results. This is the case for all the plot functions with ggshakeR.
Data: stoke vs boro.xlsx
Screenshot examples:
ggshakeR version: 0.2.0.9000 R version: RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for macOS Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_1) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36
Never done a reprex before, hope this works for you?
Created on 2022-08-19 with reprex v2.0.2