Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot arcs method #84

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

minimav
Copy link

@minimav minimav commented Jan 21, 2023

Hi, I've had a go at issue #14 in this PR. I'm not sure if there are existing methods to achieve some of what I do in the methods, let me know if you know of easier ways :)

Below are screenshots of what the example will produce for both pitch orientations, plotting arcs at 5, 10, 20 and 30 metres:

Screenshot 2023-01-21 at 09 21 56

Screenshot 2023-01-21 at 09 22 10

def plot_arcs_around_goals_on_pitches(pitch_cls):
fig, axes = plt.subplots(4, 2, figsize=(12, 14))
axes = axes.ravel()
pitch_types = ['statsbomb', 'opta', 'tracab', 'skillcorner', 'wyscout',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a simplified version of examples/pitch_setup/plot_compare_pitches.py which I was using to make sure I dealt with the subtleties of the different coordinate systems and aspect ratios.

Comment on lines +342 to +344
self._draw_arc(
ax, ymin + self.pad_bottom, x, height, width, theta1=-90, theta2=90, **kwargs
)
Copy link
Author

@minimav minimav Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _draw_arc method on a VerticalPitch switches orientations for you. Due to how I worked out the co-ordinates I have 'undone' the switch in the arguments passed here so that it works out correctly. I was not really sure how to go about this in such a way that this extra switch wouldn't be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant