.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/basic/plot_arcs.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_basic_plot_arcs.py: Arcs ==== This example showcases the ability of `iplotx` to curve edges into arcs, using tension to define the angular span of the arc. .. GENERATED FROM PYTHON SOURCE LINES 7-25 .. code-block:: Python import igraph as ig import matplotlib.pyplot as plt import iplotx as ipx g = ig.Graph.Full(4) layout = [[0, 0], [1, 0], [2, 0], [3, 0]] fig, ax = plt.subplots() ipx.plot( g, layout=layout, ax=ax, edge_arc=True, edge_tension=-1, ) .. image-sg:: /gallery/basic/images/sphx_glr_plot_arcs_001.png :alt: plot arcs :srcset: /gallery/basic/images/sphx_glr_plot_arcs_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [] .. GENERATED FROM PYTHON SOURCE LINES 26-27 Other values of tension can be used to create different arc shapes: .. GENERATED FROM PYTHON SOURCE LINES 28-41 .. code-block:: Python fig, axs = plt.subplots(2, 2, figsize=(8, 8)) for tension, ax in zip([0.5, 2.5, -0.5, -2.5], axs.ravel()): ipx.plot( g, layout=layout, ax=ax, edge_arc=True, edge_tension=tension, margins=0.15, title=f"Edge tension = {tension:.2f}", ) .. image-sg:: /gallery/basic/images/sphx_glr_plot_arcs_002.png :alt: Edge tension = 0.50, Edge tension = 2.50, Edge tension = -0.50, Edge tension = -2.50 :srcset: /gallery/basic/images/sphx_glr_plot_arcs_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 42-48 .. tip:: Tension is defined as the tangent of the quarter of the angle spanned by the arc. A tension of 0 gives a straight line, a tension of 1 gives a semicircle, and higher tensions give increasingly larger arcs. A tension of infinity would give you a straight line away from the target vertex, but is not accepted by the library. Negative tensions result in arcs curving in the opposite direction. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.171 seconds) .. _sphx_glr_download_gallery_basic_plot_arcs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_arcs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_arcs.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_arcs.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_