.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_simple.py: Simple Example ============== Simple example using the alpha shape toolbox .. image:: /auto_examples/images/sphx_glr_plot_simple_001.png :alt: plot simple :class: sphx-glr-single-img .. code-block:: default :lineno-start: 8 import alphashape import matplotlib.pyplot as plt from descartes import PolygonPatch # Define input points points = [(0., 0.), (0., 1.), (1., 1.), (1., 0.), (0.5, 0.5)] # Define alpha parameter alpha = 0. # Generate the alpha shape alpha_shape = alphashape.alphashape(points, alpha) # Initialize plot fig, ax = plt.subplots() # Plot input points ax.scatter(*zip(*points)) # Plot alpha shape ax.add_patch(PolygonPatch(alpha_shape, alpha=.2)) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.109 seconds) .. _sphx_glr_download_auto_examples_plot_simple.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: plot_simple.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_simple.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_