.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/pitch_plots/plot_markers.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_pitch_plots_plot_markers.py: ======= Markers ======= This example shows how to plot special football markers designed by the wonderful Kalle Yrjänä. .. GENERATED FROM PYTHON SOURCE LINES 9-20 .. code-block:: Python import matplotlib.patheffects as path_effects import matplotlib.pyplot as plt from mplsoccer import Pitch, football_left_boot_marker, football_right_boot_marker, \ football_shirt_marker, FontManager, VerticalPitch fm_jersey = FontManager('https://raw.githubusercontent.com/google/fonts/main/ofl/' 'jersey15/Jersey15-Regular.ttf') path_eff = [path_effects.Stroke(linewidth=2, foreground='black'), path_effects.Normal()] .. GENERATED FROM PYTHON SOURCE LINES 21-22 Plot football markers on a pitch .. GENERATED FROM PYTHON SOURCE LINES 22-33 .. code-block:: Python pitch = Pitch() fig, ax = pitch.draw(figsize=(8, 5.5)) pitch.scatter(27.5, 30, marker=football_shirt_marker, s=20000, ec='black', fc='#DA291C', ax=ax) pitch.scatter(15, 60, marker=football_left_boot_marker, s=5000, ec='#f66e90', fc='#2377c0', ax=ax) pitch.scatter(40, 60, marker=football_right_boot_marker, s=5000, ec='#f66e90', fc='#2377c0', ax=ax) pitch.text(27.5, 35, '22', va='center', ha='center', color='white', fontproperties=fm_jersey.prop, path_effects=path_eff, fontsize=50, ax=ax) .. image-sg:: /gallery/pitch_plots/images/sphx_glr_plot_markers_001.png :alt: plot markers :srcset: /gallery/pitch_plots/images/sphx_glr_plot_markers_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Text(27.5, 35, '22') .. GENERATED FROM PYTHON SOURCE LINES 34-35 Plot a formation of football shirts .. GENERATED FROM PYTHON SOURCE LINES 35-47 .. code-block:: Python pitch = VerticalPitch(pitch_type='opta') fig, ax = pitch.draw(figsize=(9, 6)) sc = pitch.formation('442', kind='scatter', marker=football_shirt_marker, s=5000, ec='black', fc='#DA291C', ax=ax) texts = pitch.formation('442', kind='text', text=[1, 2, 5, 6, 3, 7, 4, 8, 11, 10, 9], va='center', ha='center', fontproperties=fm_jersey.prop, path_effects=path_eff, fontsize=32, color='white', positions=[1, 2, 5, 6, 3, 7, 4, 8, 11, 10, 9], xoffset=-3, ax=ax) plt.show() # If you are using a Jupyter notebook you do not need this line .. image-sg:: /gallery/pitch_plots/images/sphx_glr_plot_markers_002.png :alt: plot markers :srcset: /gallery/pitch_plots/images/sphx_glr_plot_markers_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.166 seconds) .. _sphx_glr_download_gallery_pitch_plots_plot_markers.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_markers.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_markers.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_markers.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_