
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/shapes_and_collections/artist_reference.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_shapes_and_collections_artist_reference.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_shapes_and_collections_artist_reference.py:


.. _artist_reference:

================================
Reference for Matplotlib artists
================================

This example displays several of Matplotlib's graphics primitives (artists).
A full list of artists is documented at :ref:`the artist API <artist-api>`.

See also :doc:`/gallery/shapes_and_collections/patch_collection`, which groups
all artists into a single `.PatchCollection` instead.

Copyright (c) 2010, Bartosz Telenczuk
BSD License

.. GENERATED FROM PYTHON SOURCE LINES 17-60

.. code-block:: Python


    import matplotlib.pyplot as plt

    import matplotlib as mpl
    import matplotlib.lines as mlines
    import matplotlib.patches as mpatches
    import matplotlib.path as mpath

    # Prepare the data for the PathPatch below.
    Path = mpath.Path
    codes, verts = zip(*[
        (Path.MOVETO, [0.018, -0.11]),
        (Path.CURVE4, [-0.031, -0.051]),
        (Path.CURVE4, [-0.115, 0.073]),
        (Path.CURVE4, [-0.03, 0.073]),
        (Path.LINETO, [-0.011, 0.039]),
        (Path.CURVE4, [0.043, 0.121]),
        (Path.CURVE4, [0.075, -0.005]),
        (Path.CURVE4, [0.035, -0.027]),
        (Path.CLOSEPOLY, [0.018, -0.11])])

    artists = [
        mpatches.Circle((0, 0), 0.1, ec="none"),
        mpatches.Rectangle((-0.025, -0.05), 0.05, 0.1, ec="none"),
        mpatches.Wedge((0, 0), 0.1, 30, 270, ec="none"),
        mpatches.RegularPolygon((0, 0), 5, radius=0.1),
        mpatches.Ellipse((0, 0), 0.2, 0.1),
        mpatches.Arrow(-0.05, -0.05, 0.1, 0.1, width=0.1),
        mpatches.PathPatch(mpath.Path(verts, codes), ec="none"),
        mpatches.FancyBboxPatch((-0.025, -0.05), 0.05, 0.1, ec="none",
                                boxstyle=mpatches.BoxStyle("Round", pad=0.02)),
        mlines.Line2D([-0.06, 0.0, 0.1], [0.05, -0.05, 0.05], lw=5),
    ]

    axs = plt.figure(figsize=(6, 6), layout="constrained").subplots(3, 3)
    for i, (ax, artist) in enumerate(zip(axs.flat, artists)):
        artist.set(color=mpl.colormaps["hsv"](i / len(artists)))
        ax.add_artist(artist)
        ax.set(title=type(artist).__name__,
               aspect=1, xlim=(-.2, .2), ylim=(-.2, .2))
        ax.set_axis_off()
    plt.show()




.. image-sg:: /gallery/shapes_and_collections/images/sphx_glr_artist_reference_001.png
   :alt: Circle, Rectangle, Wedge, RegularPolygon, Ellipse, Arrow, PathPatch, FancyBboxPatch, Line2D
   :srcset: /gallery/shapes_and_collections/images/sphx_glr_artist_reference_001.png, /gallery/shapes_and_collections/images/sphx_glr_artist_reference_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 61-80

.. admonition:: References

   The use of the following functions, methods, classes and modules is shown
   in this example:

   - `matplotlib.path`
   - `matplotlib.path.Path`
   - `matplotlib.lines`
   - `matplotlib.lines.Line2D`
   - `matplotlib.patches`
   - `matplotlib.patches.Circle`
   - `matplotlib.patches.Ellipse`
   - `matplotlib.patches.Wedge`
   - `matplotlib.patches.Rectangle`
   - `matplotlib.patches.Arrow`
   - `matplotlib.patches.PathPatch`
   - `matplotlib.patches.FancyBboxPatch`
   - `matplotlib.patches.RegularPolygon`
   - `matplotlib.axes.Axes.add_artist`


.. _sphx_glr_download_gallery_shapes_and_collections_artist_reference.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: artist_reference.ipynb <artist_reference.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: artist_reference.py <artist_reference.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: artist_reference.zip <artist_reference.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
