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

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_shapes_and_collections_marker_path.py>`
        to download the full example code

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

.. _sphx_glr_gallery_shapes_and_collections_marker_path.py:


===========
Marker Path
===========

Using a `~.path.Path` as marker for a `~.axes.Axes.plot`.

.. GENERATED FROM PYTHON SOURCE LINES 8-25

.. code-block:: default

    import matplotlib.pyplot as plt
    import matplotlib.path as mpath
    import numpy as np


    star = mpath.Path.unit_regular_star(6)
    circle = mpath.Path.unit_circle()
    # concatenate the circle with an internal cutout of the star
    verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]])
    codes = np.concatenate([circle.codes, star.codes])
    cut_star = mpath.Path(verts, codes)


    plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15)

    plt.show()




.. image:: /gallery/shapes_and_collections/images/sphx_glr_marker_path_001.png
    :alt: marker path
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 26-33

------------

References
""""""""""

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

.. GENERATED FROM PYTHON SOURCE LINES 34-42

.. code-block:: default


    import matplotlib
    matplotlib.path
    matplotlib.path.Path
    matplotlib.path.Path.unit_regular_star
    matplotlib.path.Path.unit_circle
    matplotlib.axes.Axes.plot
    matplotlib.pyplot.plot




.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none


    <function plot at 0x7f73be827ee0>




.. _sphx_glr_download_gallery_shapes_and_collections_marker_path.py:


.. only :: html

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



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

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



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

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


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
