.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/style/plot_halfarrows.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_style_plot_halfarrows.py: Half arrows =========== This example demonstrated the use of half arrows for directed graphs. .. GENERATED FROM PYTHON SOURCE LINES 7-39 .. code-block:: Python import matplotlib.pyplot as plt import iplotx as ipx g = { "edges": [ ("alice", "bob"), ("bob", "alice"), ("alice", "jago"), ("jago", "alice"), ("bob", "jago"), ("jago", "bob"), ], "directed": True, } layout = { "alice": (0, 0), "bob": (1, 0), "jago": (0.5, 0.85), } fig, ax = plt.subplots(figsize=(3, 2.7)) ipx.network( g, layout=layout, ax=ax, edge_arrow_marker="|/", edge_paralleloffset=-7, edge_arrow_width=15, ) .. image-sg:: /gallery/style/images/sphx_glr_plot_halfarrows_001.png :alt: plot halfarrows :srcset: /gallery/style/images/sphx_glr_plot_halfarrows_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [] .. GENERATED FROM PYTHON SOURCE LINES 40-42 A similar effect can be obtained with the other half arrow, by flipping the paralleloffset sign as well. In this case the opposite half arrow is shown: .. GENERATED FROM PYTHON SOURCE LINES 42-53 .. code-block:: Python fig, ax = plt.subplots(figsize=(3, 2.7)) ipx.network( g, layout=layout, ax=ax, edge_arrow_marker="|\\", edge_paralleloffset=7, edge_arrow_width=15, ) .. image-sg:: /gallery/style/images/sphx_glr_plot_halfarrows_002.png :alt: plot halfarrows :srcset: /gallery/style/images/sphx_glr_plot_halfarrows_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [] .. GENERATED FROM PYTHON SOURCE LINES 54-55 If no parallel offset is set, the effect is a little different: .. GENERATED FROM PYTHON SOURCE LINES 55-66 .. code-block:: Python fig, axs = plt.subplots(1, 2, figsize=(6, 2.4)) for ax, marker in zip(axs, ["|/", "|\\"]): ipx.network( g, layout=layout, ax=ax, edge_arrow_marker=marker, edge_paralleloffset=0, edge_arrow_width=15, ) .. image-sg:: /gallery/style/images/sphx_glr_plot_halfarrows_003.png :alt: plot halfarrows :srcset: /gallery/style/images/sphx_glr_plot_halfarrows_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.111 seconds) .. _sphx_glr_download_gallery_style_plot_halfarrows.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_halfarrows.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_halfarrows.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_halfarrows.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_