

.. _sphx_glr_gallery_shapes_and_collections:

.. _shapes_and_collections_examples:


Shapes and collections
======================



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Adding arrow patches to plots.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_arrow_guide_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_arrow_guide.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Arrow guide</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example displays several of Matplotlib&#x27;s graphics primitives (artists). A full list of artists is documented at the artist API &lt;artist-api&gt;.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_artist_reference_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_artist_reference.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Reference for Matplotlib artists</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="For the first two subplots, we will use spirals.  Their size will be set in plot units, not data units.  Their positions will be set in data units by using the offsets and offset_transform keyword arguments of the LineCollection and PolyCollection.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_collections_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_collections.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Line, Poly and RegularPoly Collection with autoscaling</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Make a compound path -- in this case two simple polygons, a rectangle and a triangle.  Use CLOSEPOLY and MOVETO for the different parts of the compound path">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_compound_path_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_compound_path.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Compound path</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to draw, and manipulate shapes given vertices and nodes using the Path, PathPatch and transforms classes.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_dolphin_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_dolphin.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Dolphins</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Draw donuts (miam!) using Path\s and PathPatch\es. This example shows the effect of the path&#x27;s orientations in a compound path.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_donut_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_donut.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Mmh Donuts!!!</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This demo shows how to draw an ellipse with an orientation arrow (clockwise or counterclockwise). Compare this to the Ellipse collection example &lt;/gallery/shapes_and_collections/ellipse_collection&gt;.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_ellipse_arrow_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_ellipse_arrow.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Ellipse with orientation arrow demo</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Drawing a collection of ellipses. While this would equally be possible using a EllipseCollection or PathCollection, the use of an EllipseCollection allows for much shorter code.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_ellipse_collection_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_ellipse_collection.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Ellipse Collection</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Draw many ellipses. Here individual ellipses are drawn. Compare this to the Ellipse collection example &lt;/gallery/shapes_and_collections/ellipse_collection&gt;.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_ellipse_demo_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_ellipse_demo.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Ellipse Demo</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="The following examples show how to plot boxes (`.FancyBboxPatch`) with different visual properties.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_fancybox_demo_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_fancybox_demo.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Drawing fancy boxes</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Hatches can be added to most polygons in Matplotlib, including bar, fill_between, contourf, and children of Polygon. They are currently supported in the PS, PDF, SVG, macosx, and Agg backends. The WX and Cairo backends do not currently support hatching.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_hatch_demo_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_hatch_demo.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Hatch demo</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Hatches can be added to most polygons in Matplotlib, including bar, fill_between, contourf, and children of Polygon. They are currently supported in the PS, PDF, SVG, macosx, and Agg backends. The WX and Cairo backends do not currently support hatching.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_hatch_style_reference_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_hatch_style_reference.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Hatch style reference</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Matplotlib can efficiently draw multiple lines at once using a LineCollection.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_line_collection_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_line_collection.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Plot multiple lines using a LineCollection</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to use collections.PatchCollection.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_patch_collection_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_patch_collection.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Circles, Wedges and Polygons</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to create Path and PathPatch objects through Matplotlib&#x27;s API.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_path_patch_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_path_patch.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">PathPatch object</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example showcases the PathPatch object to create a Bezier polycurve path patch.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_quad_bezier_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_quad_bezier.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Bezier curve</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example showcases a simple scatter plot.">

.. only:: html

  .. image:: /gallery/shapes_and_collections/images/thumb/sphx_glr_scatter_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_shapes_and_collections_scatter.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Scatter plot</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/shapes_and_collections/arrow_guide
   /gallery/shapes_and_collections/artist_reference
   /gallery/shapes_and_collections/collections
   /gallery/shapes_and_collections/compound_path
   /gallery/shapes_and_collections/dolphin
   /gallery/shapes_and_collections/donut
   /gallery/shapes_and_collections/ellipse_arrow
   /gallery/shapes_and_collections/ellipse_collection
   /gallery/shapes_and_collections/ellipse_demo
   /gallery/shapes_and_collections/fancybox_demo
   /gallery/shapes_and_collections/hatch_demo
   /gallery/shapes_and_collections/hatch_style_reference
   /gallery/shapes_and_collections/line_collection
   /gallery/shapes_and_collections/patch_collection
   /gallery/shapes_and_collections/path_patch
   /gallery/shapes_and_collections/quad_bezier
   /gallery/shapes_and_collections/scatter

