.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "sphinx_gallery_output/plot_07_custom_layout.py" .. LINE NUMBERS ARE GIVEN BELOW. .. 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_sphinx_gallery_output_plot_07_custom_layout.py: Custom Node Positions and Edge Paths ==================================== Node positions can be set explicitly by using a dictionary that maps node IDs to (x, y) coordinates as the :code:`node_layout` keyword argument. Analogously, edge paths can be set explicitly by using a dictionary that maps edge IDs to ndarray of (x, y) coordinates as the :code:`edge_layout` keyword argument. .. GENERATED FROM PYTHON SOURCE LINES 12-29 .. image-sg:: /sphinx_gallery_output/images/sphx_glr_plot_07_custom_layout_001.png :alt: plot 07 custom layout :srcset: /sphinx_gallery_output/images/sphx_glr_plot_07_custom_layout_001.png :class: sphx-glr-single-img .. code-block:: default import numpy as np import matplotlib.pyplot as plt from netgraph import Graph edge_list = [(0, 1)] node_positions = { 0 : (0.2, 0.4), 1 : (0.8, 0.6) } edge_paths = { (0, 1) : np.array([(0.2, 0.4), (0.2, 0.8), (0.5, 0.8), (0.5, 0.2), (0.8, 0.2), (0.8, 0.6)]) } Graph(edge_list, node_layout=node_positions, edge_layout=edge_paths) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.087 seconds) .. _sphx_glr_download_sphinx_gallery_output_plot_07_custom_layout.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_07_custom_layout.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_07_custom_layout.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_