pitch = Pitch(
line_zorder=2,
pitch_type="secondspectrum",
half=False,
pitch_length=events.metadata.pitch_dimensions.pitch_length,
pitch_width=events.metadata.pitch_dimensions.pitch_width,
)
fig, ax = pitch.draw()
ax.set_title(f"Brazil & Cameroon Shots")
for event in events:
if event.coordinates is not None and event.result_coordinates is not None:
color = "#479A50" if event.team == home_team else "#FFDC02"
x = event.coordinates.x
y = event.coordinates.y
x_end = event.result_coordinates.x
y_end = event.result_coordinates.y
pitch.scatter(x, y, ax=ax, s=100, color=color, edgecolors="black")
pitch.arrows(x, y, x_end, y_end, ax=ax, width=2, headwidth=5,
headlength=5, color=color, alpha=0.6)