This release is a major refactor of mplsoccer and a merger with soccerplots for plotting Radars.
- ❌
orientation
argument is removed.
To plot on a vertical pitch use the newVerticalPitch
class. - ❌
layout
argument is removed. Use the Matplotlib stylenrows
andncols
instead.
For example, Pitch(layout=(4, 5)) becomes Pitch(nrows=4, ncols=5). - ❌
view
argument is removed. Use half=True to display half-a-pitch.
For example, Pitch(view='half') becomes Pitch(half=True). - ❌
pitch_type=stats
pitch_type option removed. - ❌ removed
jointplot
method and replaced with the more flexiblejointgrid
method. - ❗
add_image
takes a file_path now rather than
a PIL image or NumPy array.
- ✅
hexbin
now clips to the sides of the soccer pitch for more
attractive visualizations. - ❗
wyscout
goal width increased to 12 units (from 10 units)
to align with ggsoccer. This matters as the newStandardizer
class uses the goalpost dimensions. - ❗ fixed
bin_statistic_positional
andheatmap_positional
so the heatmaps are created consistently at the heatmap edges
i.e. grid cells are created from the bottom to the top of the pitch, where the top edge
always belongs to the cell above.
- 😍 Merged mplsoccer with soccerplots
for wonderful radar charts. - 🍓 Added
jointgrid
method to draw optional marginal axes on the four-sides
of a soccer pitch. This replaces the oldjointplot
, which did not allow non-square pitches. - 🍓 Added the
grid
method to create a grid of pitches with more control
than plt.subplots. - 🍓 Added
FontManager
from ridge_map
by Colin Carroll for downloading and using google fonts. - 🍓 Added
Standardizer
for changing from one provider data format to another.
For example, StatsBomb to Tracab. - 🍦 Added new pitch_types:
skillcorner
,secondspectrum
, and acustom
pitch type where the length and width can vary. - 🍦 Added
goal_alpha
for controlling the transparency ofgoal_type='box'
goals. - 🍦 Added
goal_type='circle'
to plot the goalposts as circles. - 🆕 Added
degrees=True
option so calculate_angle_and_degrees can output the angle
in degrees clockwise. - 🆕 Added
create_transparent_cmap
to enable colormaps that vary from high transparency
to low transparency.
- 🆗 Changed
Seaborn
x and y from arguments to keyword arguments.
This fixes a FutureWarning from Seaborn that the only valid positional argument will be data. - 🆗 Changed imports so that you do not need to reference the module.
For example, from mplsoccer import Pitch. - 🆗 Added repr methods for string representations of classes.
- 🆗 Stopped the storage of the Matplotlib figure and axes in the pitch class attributes.
- 📃 Added examples for custom colormaps
- 📃 Tweaked the StatsBomb data example to only update files if the
JSON file has changed. - 📃 Added more beautiful scatter examples.
- 📃 Added examples for
grid
andjointgrid
.
The pitch class has been split into multiple modules and classes to simplify the code. This helps reduce the number of conditional if/else switches.
- pitch.py contains the new classes for plotting/ drawing pitches. The
Pitch
class is for a
horizontally orientated soccer pitch, and the newVerticalPitch
is for the
vertical orientation. A change from the old API of Pitch(orientation='vertical'). - The
Pitch
andVerticalPitch
classes inherit their
plotting methods fromBasePitchPlot
. WhileBasePitchPlot
inherits attributes and methods
for drawing a soccer pitch fromBasePitch
. - The soccer pitch dimensions are in a separate module (dimensions.py) for reuse within
a newStandardizer
class. - The code for heatmaps, arrows, lines, scatter_rotation, and scatter_football are now
in separate modules (heatmap.py, quiver.py, linecollection.py, and scatterutils.py).
Fixed the statsbomb module to allow a requests response to be used in read_event, read_match, read_competition and read_lineup. This should allow the statsbomb module to be used with the StatsBomb API via the requests library.
Fixed statsbomb read_event to read the z location, as StatsBomb recently changed their data so it also records the shot impact height 'z' location.
- changed the name of the 'statsperform' pitch_type to 'uefa'
- changed the background zorder from 0.8 -> 0.6 so it defaults to below the new Juego de posición pitch markings
- changed the center circle size for the opta, wyscout, statsbomb, and stats pitches to align with the edge of the six-yard box
- amended the fbref plotting example to work for all five of the leagues.
- arrows can now take *args to allow colors to be set using C via a cmap.
- fixed a bug for the metricasports pitch so the center circle and arcs plot when the pitch_width and pitch_length are the same size
- fixed a bug for the Voronoi plot where the wyscout, opta, and metricasports data wasn't scaled appropriately to a full-sized pitch
- fixed bin_statistic so the binning of data is always consistent from the bottom to the top of the pitch. Previously pitches with an inverted axis were binned top to bottom. This does not currently apply to bin_statistic_positional.
- added a method calculate_angles_and_distance to calculate the angle and distance from start and end locations.
- added an example for plotting a pass network contributed by DymondFormation.
- added parameters to shade the middle section of the pitch and draw Juego de posición pitch markings.
- added a method flow to plot a pass flow map and a new example using this method
- Fixed arrows so the arrows scale correctly when the dots per inches (dpi) of the figure is changed. Before the units were in dots so the arrow got smaller as the dots per inches increases. Fixed this so the arrow is in points (1/72th of an inch) so the arrow stays the same size when the dots per inch changes.
- Fixed arrows legend to work in recent versions of matplotlib.
- changed the event_type_name/ event_type_id columns in the StatsBomb data to sub_type_name, sub_type_id.
- combined the StatsBomb technique columns (pass_technique, goalkeeper_technique, shot_technique) into techique_id and technique_name
- combined the Statsbomb type columns (pass_type, duel_type_id, goalkeeper_type, shot_type) into event_type_name and event_type_id
- removed StatsBomb columns that repeat other columns: pass_through_ball, pass_outswinging, pass_inswinging, clearance_head, clearance_left_foot, clearance_right_foot, pass_straight, clearance_other, goalkeeper_punched_out, goalkeeper_shot_saved_off_target, shot_saved_off_target, goalkeeper_shot_saved_to_post, shot_saved_to_post, goalkeeper_lost_out, goalkeeper_lost_in_play, goalkeeper_success_out, goalkeeper_success_in_play, goalkeeper_saved_to_post, shot_kick_off, goalkeeper_penalty_saved_to_post
- changed Pitch so axes aren't raveled when using subplots, e.g. layout=(2, 2). So colorbar can be used with subplots.
- changed the internal workings of bin statistics and heatmaps so the results of bin_statistic can be used for other purposes.
- removed print function from Pitch.
- changed the wyscout goal posts y locations to 45/ 55 for consistency with socceraction.
- fixed the statsbomb module so the event dataset has simplified names for the end coordinates. Previously they were shot_end_x, pass_end_x etc. Now they are under three columns: end_x, end_y, end_z.
- fixed the statsbomb module so it works when the json is empty.
- Added Pitch.voronoi() for calculating Voronoi vertices.
- Added Pitch.goal_angle() for plotting the angle to the goal.
- Added Pitch.polygon() for plotting polygons on the pitch (e.g. goal angle and Voronoi)
- Added add_image for adding images to matplotlib figures.
- Made the statsbomb module clean the data faster.
- fixed Pitch.label_heatmap(). Now filters out labels outside of the pitch extent.
- fixed Pitch.bin_statistic(). Now works for
statistic
arguments other than 'count'.
- fixed Pitch.heatmap() bug. Now returns a mesh in horizontal orientation.
- Docs and gallery added.
- Added option to change the penalty and center spot size via spot_scale.
- Added legend handlers for plotting footballs in the scatter method, arrows in the arrows method, and lines in the lines method of the Pitch class.
- utils module renamed scatterutils
- Pitch.quiver() renamed Pitch.arrows()
- Default color of Pitch.lines() changed to rcparams['lines.color']
- Default hexbin cmap changed to viridis
- Pitch.lines() now takes alpha_start and alpha_end arguments. The line linearly increases in opacity from alpha_start to alpha_end if transparent=True. Previously these were hard coded as 0.1 and 0.5. The new defaults are 0.01 and 1.
- Pitch.lines() not takes cmap as an argument. You can either select cmap or color, but not both.
- Pitch.bin_statistic_positional() and Pitch.bin_statistic() return dictionaries rather than named tuples.
- Pitch defaults changed to tight_layout=True and constrained_layout=False.
- Default penalty and center spot size now smaller and can be adjusted.
- Pitch default colors changed, pitch_color is now not plotted by default ('None') and pitch lines are taken from the rcParams 'grid.color'.
Minor pep8 fixes.
- Added constrained_layout option for Pitch class
- Added line_zorder so can raise or lower pitch markings in a plot. This was necessary so you could plot the pitch lines over a heatmap.
- Added support for 'statsperform' and 'metricasports' pitch types.
- Added support for grass texture with pitch_color='grass', e.g. Pitch(pitch_color='grass').
- Added heatmap and methods to bin data and create statistics to allow plotting of heatmaps over pitches.
- Added an arrowhead_marker. Example use: from mplsoccer.utils import arrowhead_marker; Pitch.scatter(x,y,marker='arrowhead_marker).
- Added support for marker rotation, e.g. Pitch.scatter(x,y,rotation_degrees=rotation_degrees). The rotation is in degrees and clockwise. Zero degrees is aligned with the direction of play, i.e. left to right in the horizontal orientation and bottom to top in vertical orientation.
- Added data checks around how padding is used so that you can't accidentally remove the pitch or flip the axis by setting pad_left, pad_right, pad_top,pad_bottom too negative in the Pitch class.
- Added Statsbomb data support to read data from the open-data repo (https://github.com/statsbomb/open-data).
- Added various ValueErrors to ensure that the size of input arrays for plots are the same.
- Default pitch_type is now 'statsbomb'. It was 'opta'.
- Changed defaults for Pitch class: tight_layout=False and constrained_layout=True
- Renamed Pitch.joint_plot() to Pitch.jointplot() to align with Seaborn.
- Pitch backgrounds now plotted internally with the method Pitch._set_background().
- Fixed jointplot to clip to pitch outline.
- Fixed 'wyscout' pitch type. The 0,0 coordinate is meant to be top left.
- Fixed the Pitch.lines() method to take a non-sequence (e.g. one line).
- Fixed the Pitch.lines() method so that when transparent=True its consistent across pitch types. It is more transparent at the line start and more opaque at the line end.
- Fixed how dimensions are represented in the Pitch class internally (left, right, bottom, top) so they match the horizontal pitch orientation.
- Fixed the README so it loads pictures from the raw GitHub files.
Initial version. Pitch class with plotting methods: scatter, lines, quiver, kdeplot, hexbin, and joint_plot. Scatter accepts marker='football' to plot footballs.