.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/other/plot_edit_artists.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_other_plot_edit_artists.py: Editing artists after plotting ============================== One of the strengths of `iplotx` is the support for editing artists after they have been plotted the first time without making a whole new figure. In this example, we will change vertices, edges, arrows, etc. and check out how they look like. .. GENERATED FROM PYTHON SOURCE LINES 13-14 This is the vanilla version, taken from the "Ports" gallery example: .. GENERATED FROM PYTHON SOURCE LINES 14-33 .. code-block:: Python import igraph as ig import iplotx as ipx g = ig.Graph.Ring(3, directed=True) artist = ipx.network( g, layout="circle", edge_curved=True, edge_ports=[ ("n", "w"), # exit from the top, enter from the left ("e", "s"), # exit from the right, enter from the bottom ("n", "s"), # exit from the top, enter from the bottom ], edge_tension=[1.5, 1.8, 0.8], edge_color=["tomato", "steelblue", "purple"], )[0] .. image-sg:: /gallery/other/images/sphx_glr_plot_edit_artists_001.png :alt: plot edit artists :srcset: /gallery/other/images/sphx_glr_plot_edit_artists_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 34-35 Now we can change the vertex sizes: .. GENERATED FROM PYTHON SOURCE LINES 35-61 .. code-block:: Python # sphinx_gallery_thumbnail_number = 2 # SAME BLOCK AS BEFORE, ONLY NEEDED TO MAKE A NEW FIGURE artist = ipx.network( g, layout="circle", edge_curved=True, edge_ports=[ ("n", "w"), # exit from the top, enter from the left ("e", "s"), # exit from the right, enter from the bottom ("n", "s"), # exit from the top, enter from the bottom ], edge_tension=[1.5, 1.8, 0.8], edge_color=["tomato", "steelblue", "purple"], )[0] # END OF SAME BLOCK artist.get_vertices().set_sizes([5, 5, 40]) artist.get_edges().set_ports( [ ("n", "n"), ("w", None), ("e", "s"), ] ) artist.get_edges().set_tension([1.3, 0.3, 0.5]) .. image-sg:: /gallery/other/images/sphx_glr_plot_edit_artists_002.png :alt: plot edit artists :srcset: /gallery/other/images/sphx_glr_plot_edit_artists_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.059 seconds) .. _sphx_glr_download_gallery_other_plot_edit_artists.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_edit_artists.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_edit_artists.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_edit_artists.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_