Making Your Own Shot and Pass Maps

Поділитися
Вставка
  • Опубліковано 11 вер 2024

КОМЕНТАРІ • 68

  • @Yusuf-dx4hw
    @Yusuf-dx4hw 3 роки тому +9

    Thank you for your contributes Sir.You got me dreaming by this course.I couldn't be a footballer but I believe I may catch my passion by helping footballer on the pitch.Hope to meet you.Greetings from Turkey.

  • @ashayshah7
    @ashayshah7 4 роки тому +9

    Thanks for the video. Really helpful ! One correction though -
    It should be " - dy" instead of "dy" in the command >>> passArrow = plt.Arrow(x, pitchWidthY- y, dx, -dy)

    • @BigDataSport
      @BigDataSport 4 роки тому

      Many thanks very true

    • @gunasekaranm5775
      @gunasekaranm5775 4 роки тому

      Can you pls explain me the use of dx-x and dy-y and similarly pitchlength-x and pitchwidth-y ?

  • @aliwualk
    @aliwualk 4 роки тому +1

    Thank you Mr Sumper, I am learning a lot and is enjoyable too.
    I hope you don't mind I leave the code from the passes exercise
    Regards.
    # draw passes
    for label, thepass in passes.iterrows():
    if thepass['player_name'] == 'Sara Caroline Seger':
    x = thepass['location'][0]
    y = thepass['location'][1]
    passCircle=plt.Circle((x, pitchWidthY-y),2, color="blue")
    passCircle.set_alpha(.2)
    ax.add_patch(passCircle)
    dx = thepass['pass_end_location'][0]-x
    dy = thepass['pass_end_location'][1]-y
    passArrow = plt.Arrow(x, pitchWidthY-y, dx, dy, width=3, color='blue')
    ax.add_patch(passArrow)
    fig.set_size_inches(10, 7)
    fig.savefig('passes.pdf', dpi=100)
    plt.show()

  • @jackybec5076
    @jackybec5076 3 роки тому

    Really appreciate what you've done in the video and very much love your accent!

  • @yuchenzhao2663
    @yuchenzhao2663 2 роки тому +1

    I tried to plot the shot map with (x, y) in dataset. It seem like both team attack from left to right.
    I also tried to do the same thing with (pitchLengthX-x, pitchLengthY-y) for Sweden shot map which switches Sweden attack from right to left.
    In both case, Eva Sofia Jakobsson goal is on the right-hand side of offensive side.
    However, the goal is on the left-hand side of offensive side in the sample code.
    Could anyone help me sort it out? Did I do anything wrong?

  • @L_D9814
    @L_D9814 3 роки тому +2

    when i open the link to github page browser show me 'Page not found', could you reload the files please? Thank you very much

  • @gunasekaranm5775
    @gunasekaranm5775 4 роки тому +3

    Can anyone explain me why the "pitchlengthX-x" and "pitchwidthy-y" when and where to use it ? Why not plot the same ?
    Is it so that we include the 1st and 2nd halves played by the team when we do that ?

    • @cirocordeiro1293
      @cirocordeiro1293 4 роки тому +3

      You don't necessarily have to do that. I believe he did this to leave the pitch at the same orientation of the TV camera, you can check that by watching the videos of that particular match. Also, the positions of both teams come as if they were attacking to the same side.

    • @danilohenrique516
      @danilohenrique516 4 роки тому +3

      I don't know if you are still having issues understanding this, but, in contrast with what Ciro said, I don't think it is optional. If you don't do it it won't reflect the correct place of events, imo. It happens because there is a difference between matplotlib's coordinate system and Statsbomb's one. I wrote a blog post about the exercise in this class where I mention this if you are still interested: dunderdanilo.com/plotting-passes/

  • @sarabentelli6632
    @sarabentelli6632 3 роки тому

    Thank you so much, that's what i need .

  • @PeterFMP
    @PeterFMP 4 роки тому +4

    The github link isn't working. Think this is the one that should be there though... github.com/Friends-of-Tracking-Data-FoTD/SoccermaticsForPython

  • @hervesimons9610
    @hervesimons9610 4 роки тому +1

    Sorry but I've got a problem impossible to draw the pitch however I open FCPython modul. I draw a pitch but from the FC Python site directly and it works. And after it's impossible to plot the passes but I suppose it's link to the pitch not from the FCPython modul.

    • @sethlxk
      @sethlxk 4 роки тому

      mate i have an error that says 'no module named FCPython' do you know how to fix it?

    • @BigDataSport
      @BigDataSport 4 роки тому +1

      @@sethlxk you should have the working directory in the path of your FCPython.py file check in the upper part of spyder if you are positioned in the folder of SoccermaticsForPython downloaded from github

  • @tomk961
    @tomk961 3 роки тому

    at around 4:00, David mentions that the positions of player' not-on-the-ball wouldn't be tracked.
    Does anybody know of any decent material describing how this can be achieved? It's multi-object tracking, sure. But How to map those objects onto a pitch, using say- two camera angles?
    Thanks

  • @jakubflorek1930
    @jakubflorek1930 4 роки тому +1

    I am afraid the github link is dead :/ Can anyone repair it?

  • @itaybiran6866
    @itaybiran6866 2 роки тому

    if i want to get all Harry Kane shots on the world cup, what do i need to do? i didnt finde the way to get all matchs data.

  • @M2N489
    @M2N489 4 роки тому

    Hello, when I try to load in the data, it says the file or directory does not exist. However I went to the source in the comment of the code and found the file and viewing the raw code shows me it is the same data as used before with the correct ID. I know this is a few months later so something could be outdated, but any chance for some help with this?

  • @benvulu1551
    @benvulu1551 4 роки тому

    Hello, I'm getting an error with line 30, TypeError: json_normalize() got an unexpected keyword argument 'sep'. Has anyone else had this issue? If so, can you provide a solution. No luck searching google. Thanks

  • @AmitKumar-wz4wb
    @AmitKumar-wz4wb 3 роки тому

    Anyone else getting this error: NameError: name 'pitchLengthX' is not defined
    ? Not able to plot the pitch after importing FCPython

  • @damianesene8486
    @damianesene8486 3 роки тому

    The git hub page seems to be out, any other way one can get this code? Thanks

  • @71pwr
    @71pwr 3 роки тому

    great stuff

  • @Buendia41st
    @Buendia41st 3 роки тому

    is that an error?
    runcell(0, 'C:/Users/zanay/Documents/Base de datos friends of tracking/SoccermaticsForPython-master/2PlotShotsAndPasses.py')
    Traceback (most recent call last):
    File "C:\Users\zanay\Documents\Base de datos friends of tracking\SoccermaticsForPython-master\2PlotShotsAndPasses.py", line 23, in
    with open('Statsbomb/data/events/'+file_name) as data_file:
    FileNotFoundError: [Errno 2] No such file or directory: 'Statsbomb/data/events/69301.json'

  • @gerardvilanovapallise8492
    @gerardvilanovapallise8492 4 роки тому +1

    I couldn't plot the passes. What I'm doing wrong?
    #Plot the passes
    from FCPython import createPitch
    (fig,ax) = createPitch(pitchLengthX,pitchWidthY,'yards','gray')
    for i,thepass in passes.iterrows():
    if thepass ['player_name']=='Sara Caroline Seger':
    x=thepass['location'][0]
    y=thepass['location'][1]
    passCircle=plt.Circle((x,PitchWidthY-y),2,color="blue")
    passCircle.set_alpha(.2)
    ax.add_patch(passCircle)
    dx=thepass['pass_end_location'][0]-x
    dy=thepass['pass_end_location'][1]-y
    passArrow=plt.Arrow(x,PitchWidthY-y,dx,-dy,width=3,color="blue")
    fig-set_size_inches(10,7)
    fig.savefig('Output/passes.pdf',dpi=100)
    plt-show()

    • @gunasekaranm5775
      @gunasekaranm5775 4 роки тому

      Why -dy in Arrow() again, you've already did that in the previous line , I used dy-y only once and it worked fine for me, maybe try that !

  • @khchan82
    @khchan82 3 роки тому

    Hi, I have a problem installing FCPython module in Anaconda. I was typing "conda install FCPython" in my terminal but it returns an error code "zsh: command not found: conda". Did I not have my Anaconda properly installed?

    • @gregtorlinski3249
      @gregtorlinski3249 3 роки тому

      I'm guessing you already figured this out but in case you haven't:
      1. FCPython is not a module but a file. In Python importing files and modules has shares the "import" syntax. If you cloned his github repo you should have a file in there called FCPython.py
      2. It does look like conda isn't working, maybe you haven't added it to path? stackoverflow.com/questions/31615322/zsh-conda-pip-installs-command-not-found

  • @samgustafson4485
    @samgustafson4485 4 роки тому +1

    For the shot maps, is it possible to get the player’s nickname displayed for the goals instead of their full names?

    • @atishayjain1563
      @atishayjain1563 4 роки тому

      try using .split()

    • @fisheatsyourhead
      @fisheatsyourhead 2 роки тому

      if it's a whole string like "firstname lastname" you can use name_variable.split(" ") , or otherwise if it's custom nicknames that aren't in the dataset, i.e. south american nicknames then you can make a map with the original names as keys and the nicknames as values so you would go: nickname=map_name["original name"] to give you the nickname

  • @alexrathke5486
    @alexrathke5486 4 роки тому

    How did you bring the pitch in - that step was skipped completely..? I know the code is there yet how do you import it. I'm trying a work around of writing the code and plotting the for loop just before the chart output (plt.show)

  • @michaelgraham2596
    @michaelgraham2596 4 роки тому +3

    Anyone else had this problem? I get "MemoryError: In RendererAgg: Out of memory" when I try to draw the initial shot map and I can't figure out how to fix it.

  • @NhatPham-px9uj
    @NhatPham-px9uj 4 роки тому

    Hi, I could not access to the discord channel. Can anyone invite me to the group? I would really appreciate it.

  • @Zigabyte97
    @Zigabyte97 4 роки тому

    I'm having a problem when I try and experiment with different competitions and league, when I plot a player's passes most passes seem to be passed to the outside of the pitch. Found this using La Liga competition files and Women's League files. Any help?

    • @christophd.4278
      @christophd.4278 4 роки тому

      If you try to plot an arrow you have to look at your parameters. They are starting location and dx,dy! Not the end location coordinates.

  • @dabody123456
    @dabody123456 3 роки тому

    Thanks for the video. Really helpful for me ,
    and i try hard to show both off pass and shot in plt . to can see both in displayed ... any hellp thnx

  • @alexorlandini7792
    @alexorlandini7792 4 роки тому

    So If I wanted to plot one players shots over the course of multiple games, what’s the best way to go about doing it ?

    • @gunasekaranm5775
      @gunasekaranm5775 4 роки тому

      So, I started working on it and found out how to do that ! I've written the code for separating a team's shots alone, but you can easily modify it for any particular player ! I'll attach my github link for that !
      github.com/guna1199/mi_scripts/blob/chunks/shots_alone_df.py

  • @stuartmacfarlane2317
    @stuartmacfarlane2317 3 роки тому

    Hi everyone, this is an excellent resource and has got me really into data and analytics. Has been very challenging with no previous background in python or maths/ physics. I'm looking to try and create a pass map of passes played from a specific position on the pitch, can anyone help with this or provide me with some code to look at? I've managed to plot individual player and shot maps using the stats bomb data set. Thanks in advance

  • @carlosg.urbano6888
    @carlosg.urbano6888 4 роки тому

    Good afternoon, David. First of all, THANKS A LOT for what you're doing during these hard times for those who are learning Data Analytics. In my case, I'm getting a Master Degree in Big Data in Sports, but I wanted to learn by myself some Python tools.
    My problem is that I'm not able to watch the full code you're displaying, which made me unable to display any of these maps and get a full insight of it. Would you please help me? Thanks a lot again.

    • @hrantbaloyan4652
      @hrantbaloyan4652 4 роки тому +1

      My advice would be try use 'print' in every statement.If you don't understand some code 'print out' and I think it will help.

    • @carlosg.urbano6888
      @carlosg.urbano6888 4 роки тому

      @@hrantbaloyan4652 Thanks, mate. I'll try :)

  • @rafrrf
    @rafrrf 4 роки тому

    Can someone send to me the discord invite again? The invite in the video is expirated. Thanks!

  • @frankjimenez9407
    @frankjimenez9407 4 роки тому

    Wouldn't be easier to use json_normalize? It looks way tidier

  • @sethlxk
    @sethlxk 4 роки тому

    I have this error that reads 'No module named FCPython' does anyone know how to fix this?

    • @aliwualk
      @aliwualk 4 роки тому

      You need to have the file under the same folder of the project look under description to download the code from GitHub

    • @sethlxk
      @sethlxk 4 роки тому

      @@aliwualk thanks! Any idea why some passes seem to be going out of the pitch?

    • @aliwualk
      @aliwualk 4 роки тому +1

      seth lee , No problem, my map show the all passes inside the map, just review the code, is probably a typo.
      in another comment I have paste my code for the exercise, have a look, Thanks

    • @aliwualk
      @aliwualk 4 роки тому +1

      @@sethlxk look comment:
      Christoph D.1 week ago
      If you try to plot an arrow you have to look at your parameters. They are starting location and dx,dy! Not the end location coordinates.
      REPLY

    • @sethlxk
      @sethlxk 4 роки тому +1

      @@aliwualk alright thanks mate!

  • @muhammadfaisal6052
    @muhammadfaisal6052 4 роки тому

    Hi i cant do the exercise for pass
    I wrote code by myself and it didn't work
    Can you send the pass code for me?

    • @Jimmypenguinboy
      @Jimmypenguinboy 4 роки тому

      i can send it to you, if you want. However, I have a different code style...

    • @muhammadfaisal6052
      @muhammadfaisal6052 4 роки тому

      @@Jimmypenguinboy could you please send me via email? muhfsl@gmail.com
      Thank you ,

    • @Jimmypenguinboy
      @Jimmypenguinboy 4 роки тому

      @@muhammadfaisal6052 yes, I work with jupyter notebook (instead of spyder) and with lists (instead of multiple ifs). Is that ok? The result is the same

    • @Jimmypenguinboy
      @Jimmypenguinboy 4 роки тому +1

      here you have: vascomano.github.io/Futebol/jupyter/2020/04/11/FoTlesson2.html

    • @gunasekaranm5775
      @gunasekaranm5775 4 роки тому

      @@Jimmypenguinboy Can you explain me why the "pitchlengthX-x" and "pitchwidthy-y" when and where to use it ? Why not plot the same ?
      Are we considering the 1st and 2nd halves played by the team when we do that ?

  • @sathishprasad8365
    @sathishprasad8365 4 роки тому

    Is anyone else facing issues in converting json file to a pandas dataframe? If yes and you resolved it, Please help me. Thank you!

    • @gunasekaranm5775
      @gunasekaranm5775 4 роки тому +4

      use pd.json_normalize(), the code shown in the video has been deprecated when a new pandas was released

  • @4lex355
    @4lex355 3 роки тому

    this is a bit annoying. i cannot open the links they upload

  • @vladimircc1953
    @vladimircc1953 4 роки тому

    interesting

  • @nicolaszuleta
    @nicolaszuleta 4 роки тому

    Hello fellow learners, Can someone send to me the discord invite again?

  • @AkmalRamadhanArifin
    @AkmalRamadhanArifin 2 роки тому

    Hi, can somebody generate a new discord invitation link? Thanks!