Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Display information on the fields of play for various popular sports
ResourceFunction["SportsFieldGraphics"]["sport"] displays the standard markings of the pitch for "sport". | |
ResourceFunction["SportsFieldGraphics"]["sport",gr] displays the standard markings of the pitch for "sport" together with Graphics gr. |
"Units" | "Meters" | unit system used for coordinates |
"Length" | Automatic | the length of the pitch for pitches that have variable sizes |
"Width" | Automatic | the width of the pitch for pitches that have variable sizes |
"PitchFontStyle" | Automatic | font information for text in pitch markings |
Background | Automatic | background color or Texture for the pitch, usually dark green |
"LineStyle" | Automatic | style for pitch markings, usually white |
"PitchOrigin" | {Center,Center} | where {0, 0} lies on the pitch |
Create a blank sports pitch:
In[1]:= |
Out[1]= |
Combine the pitch with other graphics:
In[2]:= |
Out[2]= |
Any Graphics object can be combined with SportsFieldGraphics:
In[3]:= |
Out[3]= |
A range of sports is supported:
In[4]:= |
Out[4]= |
You can specify the sport using a "Sport" Entity:
In[5]:= |
Out[5]= |
Where pitches have multiple background colors, you can provide Background as a list:
In[6]:= |
Out[6]= |
Background can also be set to a Texture, which will fill the field of play plus 10%:
In[7]:= |
Out[7]= |
Some sports do not prescribe exact dimensions. You can use "Length" and "Width" to override the default values:
In[8]:= |
Out[8]= |
In[9]:= |
Out[9]= |
Pitch line styles can be specified:
In[10]:= |
Out[10]= |
Use "PitchFontStyle" to change the style of any text in a pitch:
In[11]:= |
Out[11]= |
The default origin is in the center of the pitch, but you can change this with "PitchOrigin":
In[12]:= |
Out[12]= |
The default unit system for sports pitches is "Meters":
In[13]:= |
Out[13]= |
You can change this with the option "Units":
In[14]:= |
Out[14]= |
Some sports do not prescribe exact dimensions. You can use "Length" and "Width" to override the default values. If you exceed maximum or minimum sizes allowed for a sport, SportsFieldGraphic will use the closest allowed value:
In[15]:= |
Out[15]= |
As well as visualizing sports analytics data in context, you can use graphics primitives to create sports-related diagrams:
In[16]:= |
Out[16]= |
The full play area is used by default:
In[17]:= |
Out[17]= |
For cricket, you may wish to use PlotRange to show only the pitch:
In[18]:= |
Out[18]= |
If you specify settings for "Length" or "Width" that exceed maximum or minimum sizes allowed for a sport, SportsFieldGraphics will use the closest allowed value:
In[19]:= |
Out[19]= |
This work is licensed under a Creative Commons Attribution 4.0 International License