Git Product home page Git Product logo

soccermatics's People

Contributors

jogall avatar timhoare avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soccermatics's Issues

Best Custom Poster Printing Can’t Lack Good Design

Custom posters are a way for businesses to promote their company. They print most of the posters in single-sided monochrome or single-sided four-color printing. Fabric poster printing and paper poster printing are very common in promotional activity. Because of the wide range of publicity, high intensity and low cost. Printing posters are one of the most effective publicity methods at present. Such poster can achieve promotional effect also can’t lack good design.

Good design poster not only can effectively promote company image. But also can better show the company's products and services to the consumer. Only good design of poster can explain the function, purpose and advantages of the product detail. Interpret the cultural concept of the enterprise and bring good sales to the enterprise.

Why more and more company choose custom poster to promote their company?

Because printing posters only need low cost but can achieve the effect of wide dissemination. It plays a very important role in the sales of company. So target poster printing is very popular in recent years.

The most important reason why posters are so popular is the design of posters. Poster design is the main thing, while poster printing is secondary. Only good-looking and creative posters can print influential posters to attract consumers. But, you must have these three points of awareness when designing posters. So that you can design and produce a satisfactory poster. Let's take a look at it in detail!

  1. The poster design must conform to the aesthetic standards of the consumers.

With the improvement of people's living standards, everyone has their own aesthetic standards. The main purpose of poster printing design is for consumers. Thus, after we design the poster , it must be accepted by the consumers. If consumers are not interested in it, it is hard to pay attention to the content of the poster printing.

  1. Poster printing design should have good creativity

Posters are often promoted with pictures. You must be creative in the design of pictures and posters. The most important thing is to give everyone a refreshing feeling. Creative poster design can improve the grade of posters. Only printing such posters. It can attract everyone's attention and make it easy for people to accept the content of the poster.

  1. Poster printing design should pay attention to the application of color

No matter print what type of poster, you must make good use of color when designing. Express the theme of the poster printing through the appropriate color. So that can attract everyone's attention.

Through the above three points, we can clear to know the importance of poster design. Only good design can best custom poster printing. And only optimal print poster can have a good publicity effect. Then bring sales profits to the company.

Issue producing some chart types

Hi,
Thanks for your work on the package,

When I try to make some of charts I get errors.

When I follow the code on this issue (#14) I get this error when plotting the passmap, but the shot map works.

Error: Column id can't be used as a grouping variable because it's a tbl_df/tbl/data.frame

When plotting heatmaps I get this error "Error in is.finite(x) : default method not implemented for type 'list'"

Not sure where I'm going wrong and would really appreciate any pointers!

Problem Installing

Hi,

I keep on having certain issues when trying to install the soccermatics package. I am on R 4.0.0. At first it was saying it had non-zero exit status but is now saying it isn't available for my version of R. Is there anything I can do to change this?

Thanks.

Library installation error

The other day I tried to install the soccermatics library on my laptop and every attempt to install the library showed me a different error. Search on google and solve what I could, however the last mistake I showed could not solve it, find a solution or find a tutorial from the library that mentioned the error. If you could help me solve the problem I would be very grateful.

"Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘digest’"

Problem Installing

devtools::install_github("jogall/soccermatics")
Error in read.dcf(path) : Found continuation line starting ' 'soccerFlipDirec ...' at begin of record.

soccerSpokes doesn't work and usage sample is not correct

When using soccerSpokes generates this message
soccerSpokes(subset(tromso, id == 8), bins = 15, lengthPitch = 105, widthPitch = 68,heatmap = FALSE)
Error in 1:n : NA/NaN argument


help displays soccerHeatmap help page as usage example
help(soccerSpokes)

Examples

Not run:

data(tromso)

draw heatmap of player #9's position

soccerHeatmap(subset(tromso, id == 8), bins = 15)

End(Not run)

soccerPositions issue

soccerPositions(ptvisit,id_var = "id", lengthPitch = 10500, widthPitch = 6800, grass = TRUE)
Error in df %>% filter(x > 0 & x < lengthPitch & y > 0 & y < widthPitch) %>% :
could not find function "%>%"

Cannot download

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called 'cowplot'
ERROR: lazy loading failed for package 'soccermatics'

  • removing 'C:/Users/Jon Snow/Documents/R/win-library/3.5/soccermatics'
    In R CMD INSTALL
    Error in i.p(...) :
    (converted from warning) installation of package ‘C:/Users/JONSNO~1/AppData/Local/Temp/Rtmp8ui1qd/file2ec28d21467/soccermatics_0.9.4.tar.gz’ had non-zero exit status
    In addition: Warning messages:
    1: In untar2(tarfile, files, list, exdir) :
    skipping pax global extended headers
    2: In untar2(tarfile, files, list, exdir) :
    skipping pax global extended headers

Problem to install

I received the following message while trying to install soccermatics:

Error in file(file, if (append) "a" else "w") :
(convertido del aviso) cannot open file 'C:/Users/Alberto Oraa/Documents/R/win-library/3.6/00LOCK-soccermatics/00new/soccermatics/DESCRIPTION': No such file or directory
ERROR: installing package DESCRIPTION failed for package 'soccermatics'

  • removing 'C:/Users/Alberto Oraá/Documents/R/win-library/3.6/soccermatics'
    Error: Failed to install 'soccermatics' from GitHub:
    (convertido del aviso) installation of package ‘C:/Users/ALBERT~1/AppData/Local/Temp/RtmpqeqdsK/file249059661bf3/soccermatics_0.9.4.tar.gz’ had non-zero exit status

Could you help me, please?

Pitch dimensions

Collect more pitch dimensions (length, width in metres) to pass to soccermatics functions for accurate visualisation of x,y-coordinates.

Many performance datasets (e.g. WhoScored) provide relative x,y-coordinates (e.g. a scale of 0-100), but true dimensions (i.e. in metres) are required in order to determine true distances (e.g. pass length, shot distance) and accurately visualise data on the pitch.

The file pitch_dimensions.csv contains this information, although only recent EPL teams (2016-17, 2017-18) and a few others are currently listed. These data were just grabbed manually from Wikipedia pages, with units being converted to metres where only yards were given (1 m = 1.09361 yards). The alt_name column contains alternative teamname definitions (e.g. as they appear in http://football-data.co.uk) to aid team identification.

Expanding this list if pitch dimensions would be useful so I welcome any contributions made with a pull request!

Error on installation

  • installing source package 'soccermatics' ...
    ** R
    Error in .install_package_code_files(".", instdir) :
    files in 'C:/Users/dpomb/AppData/Local/Temp/RtmpisTfHK/devtools900751360cd/JoGall-soccermatics-7de0445/R' missing from 'Collate' field:
    soccerSpokes.R
    ERROR: unable to collate and parse R files for package 'soccermatics'
  • removing 'C:/Users/dpomb/Documents/R/win-library/3.4/soccermatics'
    Installation failed: Command failed (1)

devtools::install_github("jogall/soccermatics")

unable to find "location.x" and "location.y" for plotting

hey Joe!

been trying to use your recently updated package. I've been trying to replicate the cool graphs you showed with the sample data (Griezmann and France shot/pass maps) with other world cup matches but I keep running into a problem regarding the location data necessary to pass onto the graph functions like soccerShotmap(), soccerPassmap(), etc.

The matches I tried were Japan vs. Senegal, Japan vs. Belgium, and Brazil vs. Costa Rica.

For example:

WC_Matches <- FreeMatches(43)

JPN_Matches <- WC_Matches %>% filter(home_team.home_team_id == 778 | away_team.away_team_id == 778)

jp_sen <- get.matchFree(JPN_Matches[1, ])

jp_sen %>% 
  filter(player.name == "Takashi Inui") %>% 
  soccerShotmap(theme = "grey")

then I would get the error: Error in FUN(X[[i]], ...) : object 'location.y' not found

I tried to separate the coordinates found in the "location" column like so:

jp_sen %>% 
  filter(player.name == "Takashi Inui") %>% 
  separate(location, into = c("x", "y"), sep = ",") %>% 
  mutate(location.y = x %>% as.factor() %>% as.numeric(),
         location.x = y %>% as.factor() %>% as.numeric()) %>% 
  soccerShotmap(theme = "grey")

but I get a empty map with the text data but no points on the field.

Here's another example with the soccerPassmap() function:

# not work
jp_sen %>% 
  filter(team.name == "Japan") %>% 
  soccerPassmap(fill = "lightblue", arrow = "r", theme = "light")
# Error in `[.data.frame`(df, , x) : undefined columns selected

# works but wrong positioning
jp_sen %>% 
  filter(team.name == "Japan") %>% 
  separate(location, into = c("x", "y"), sep = ",") %>% 
  mutate(location.x = x %>% as.factor() %>% as.numeric(),
         location.y = y %>% as.factor() %>% as.numeric()) %>% 
  soccerPassmap(fill = "lightblue", arrow = "r", theme = "light")

jpnpassmapexample

Is there anyway you could tell me where/what that "location.x" and "location.y" data columns are supposed to be? Just checking the example data set, the coordinates in "location.x" and "location.y" seem to be very different from the coordinates in "location" so maybe I'm missing something in processing it?

Sorry for the long post, any help would be appreciated!

Installation fails

Hi!
First i tried with devtools::install_github("jogall/soccermatics") but the installation not finished ever (i don't know why),
so then i tried with install.packages("https://github.com/JoGall/soccermatics/blob/master/soccermatics_0.8.4.tar.gz", repo=NULL, type="source") but get ERROR "in getOctD(x, offset, len) : invalid octal digit"

Finally i download the .tar compressed folder (version 0.9.0 and 0.8.4) and the installation works but it's not complete. For example function "soccerShotmap" is not include there.

Add title, subtitle options to function soccerShotmap()

soccerShotmap() currently rotates a soccerPitch pitch by 90° using coord_flip(), which ends up occluding a title and/or subtitle added above the plot.

Maybe redraw half pitch horizontally or find a solution with grid or gridExtra?

Unable to install soccermatics

Unable to install soccermatics. Keeps throwing this error. Please help!!!
Error: Failed to install 'soccermatics' from GitHub:
(converted from warning) installation of package ‘C:/Users/13012/AppData/Local/Temp/RtmpOYjILm/file43284f696403/soccermatics_0.9.4.tar.gz’ had non-zero exit status

Error Installation Failed

When executing the installation command:
devtools::install_github("jogall/soccermatics")

I got the following error message and the installation then exited.
......

  • installing source package 'soccermatics' ...
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    there is no package called 'xts'
    ERROR: lazy loading failed for package 'soccermatics'
  • removing 'C:/Users/azhang/Documents/R/win-library/3.5/soccermatics'
    In R CMD INSTALL
    Installation failed: Command failed (1)

Problems with update

Hi there
I'm tryng to use the last updates but i got some errors:

Error in soccerShotmap(., theme = "grass", colGoal = "yellow", colMiss = "blue", :
unused arguments (colGoal = "yellow", colMiss = "blue", legend = T)

Error in soccerPassmap(., fill = "blue", minPass = 3, edge_max_width = 30, :
unused arguments (edge_max_width = 30, edge_col = "grey40", edge_alpha = 1)

I installed the 0.9.3 version. Is it the last version?

Thanks

To do list

A rough list of functions and utilities I'd like to add to the package. Recommendations welcomed!

🚧 = under construction
💡 = still just a pipedream

Visualisations

💡 Post-match odds based on simulating shots
🚧 Voronoi diagrams / Delaunay triangulation / convex hull
🚧 Wrapper functions to animate metrics frame by frame
💡 Defensive coverage plots

Advanced analytics

🚧 Wrapper functions for common metrics (xG, xA, forward progressions, PossAdjT&A, etc...)
💡 Event sequence plots and possession sequence metrics (possession spell and final product, i.e. does it end in final third, end in shot, end in goal)
💡 Directness, synchronisation of movement direction, space utilisation)
🚧 Space control / dominance (e.g. ratio of Voronoi areas / convex hull areas)
💡 Goalscoring threat (xG in each frame based on view to goal based on distance / angle of ball from opposition goal, number of defending players in front of goal, number of attacking players nearby, etc..); similar to this
🚧 Pressing effectiveness (e.g. average distance of defending players from ball, area of bounding box formed by defending team, time for n nearest players to close gap after possession change, etc..)

Machine learning stuff

💡 Infer individual ball possession
💡 Infer shot and pass events
💡 Modelling optimal positioning with deep imitation learning
💡 Automated formation discovery

Misc.

🚧 Add option Juego de Posicion pitch markings
💡 Make a geom_pitch layer as a less monolithic plotting function
🚧 New system for working across multiple data sources (i.e. transform StatsBomb / Opta / whatever data so they can be used in a single function for xG plots / passmaps / whatever)
🚧 Add to list of true pitch dimensions

Hi Ryo,

Hi Ryo,

This is an old issue which I am quoting:(My main issue is all the way down)

The issue here is needing to process the raw data retrieved by get.matchFree() using other StatsBombR functions like cleanlocations(). I made a helper function in a fork of the package here to automate this process if you're interested.

Once you have the cleaned data containing variables location.x and location.y, you need to use the soccerTransform() function with option method = "statsbomb" to convert the data from StatsBomb coordinates (1 <= x <= 120, 1 <= y <= 80) to metre units for plotting with soccermatics (by default this function uses 105m x 68m for pitch length and width, as do other soccermatics functions, but you can specify alternative pitch dimensions).

Code should look something like this then:

library(dplyr)

# get Japan matches
WC_Matches <- StatsBombR::FreeMatches(43)
JPN_Matches <- WC_Matches %>% 
  filter(home_team.home_team_id == 778 | away_team.away_team_id == 778)

# get all StatsBomb data
jp <- StatsBombR::allinfo(JPN_Matches)

# transform x,y-coords to real-world units for compatability with soccermatics
jp <- jp %>% 
  soccermatics::soccerTransform(method = "statsbomb")

# shotmap for multiple matches
jp %>% 
  filter(player.name == "Takashi Inui") %>% 
  soccermatics::soccerShotmap(theme = "grey",
                              title = "Takashi Inui",
                              subtitle = "World Cup 2018")

rplot08

# passmap for one match
jp_sen <- jp %>% 
  filter(match_id == 7556)
  
jp_sen %>% 
  filter(team.name == "Japan") %>% 
  soccermatics::soccerPassmap(fill = "lightblue", arrow = "r", theme = "light",
                              title = "Japan (vs. Senegal, World Cup 2018)")

rplot10

Hope that helps!

Originally posted by @JoGall in #14 (comment)

I faced a similar problem so I tried to do what you have mentioned here, JoGall. I was working on France vs Croatia game.
wc_game<- FreeMatches(Comp) France <- wc_game%>% filter(match_id == 8658)
fr <- StatsBombR::allinfo(France)

It keeps giving me an error in the second part(allinfo part).
Error: 'allinfo' is not an exported object from 'namespace:StatsBombR'

Please suggest something

soccerShotmap plotted as mirror image

When I plot an xG map using soccerShotmap, the locations are appearing as a mirror image as where they should be. I used soccerTransform to adjust the coordinates an all Statsbomb data which fixed a similar issue for soccerPassmap however this seems to have created a new issue for the shot map. Should I be using the normal Statsbomb coordinates in this case (i.e. should I not have used soccerTransform here) or is it an unrelated issue do you think?

Thanks

Events self tracked

Hi Joe! Amaizing your job in here!!

I have tracked myself some events and I'm trying to plot some passing maps. I have already the xy coordinates in meters. Could you give me a clue of how I could do this??

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.