Exemplo n.º 1
0
# Plotting

# Setup the pitch
pitch = VerticalPitch(pitch_type='statsbomb',
                      pitch_color='#22312b',
                      line_color='#c7d5cc',
                      half=True,
                      pad_top=2)
fig, ax = pitch.draw(figsize=(16, 11), tight_layout=True)

# Plot the completed passes
pitch.lines(df_pass.x,
            df_pass.y,
            df_pass.end_x,
            df_pass.end_y,
            lw=10,
            transparent=True,
            comet=True,
            cmap='jet',
            label='pass leading to shot',
            ax=ax)

# Plot the goals
pitch.scatter(df_pass[mask_goal].end_x,
              df_pass[mask_goal].end_y,
              s=700,
              marker='football',
              edgecolors='black',
              c='white',
              zorder=2,
              label='goal',
              ax=ax)
Exemplo n.º 2
0
                    ax=axs['pitch'],
                    c='#c15ca5',
                    label='Goalkeeper')

# plot the shot
sc3 = pitch.scatter(df_shot_event.x,
                    df_shot_event.y,
                    marker='football',
                    s=600,
                    ax=axs['pitch'],
                    label='Shooter',
                    zorder=1.2)
line = pitch.lines(df_shot_event.x,
                   df_shot_event.y,
                   df_shot_event.end_x,
                   df_shot_event.end_y,
                   comet=True,
                   label='shot',
                   color='#cb5a4c',
                   ax=axs['pitch'])

# plot the angle to the goal
pitch.goal_angle(df_shot_event.x,
                 df_shot_event.y,
                 ax=axs['pitch'],
                 alpha=0.2,
                 zorder=1.1,
                 color='#cb5a4c',
                 goal='right')

# fontmanager for google font (robotto)
robotto_regular = FontManager()