.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/style/plot_style.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_style.py: Basics of styling ====================== This example shows a few simple styling options available in `iplotx`. .. tip:: `iplotx` has an internal library of styles. See the :doc:`plot_multistyle` example. .. GENERATED FROM PYTHON SOURCE LINES 11-32 .. code-block:: Python import igraph as ig import matplotlib.pyplot as plt import iplotx as ipx g = ig.Graph.Ring(5) layout = g.layout("circle") style = { "vertex": { "facecolor": ["purple", "pink", "black"], "edgecolor": "black", }, "edge": { "linestyle": "--", "linewidth": 2, "color": "deeppink", }, } fig, ax = plt.subplots(figsize=(3, 3)) ipx.network(g, ax=ax, layout=layout, style=style) .. image-sg:: /gallery/style/images/sphx_glr_plot_style_001.png :alt: plot style :srcset: /gallery/style/images/sphx_glr_plot_style_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [] .. GENERATED FROM PYTHON SOURCE LINES 33-35 You can also **chain styles**. For example, you can apply an existing style first, and then modify it with a custom dictionary: .. GENERATED FROM PYTHON SOURCE LINES 35-49 .. code-block:: Python style = { "edge": { "linestyle": "--", }, } fig, ax = plt.subplots(figsize=(3, 3)) ipx.network( g, ax=ax, layout=layout, style=["rededge", style], ) .. image-sg:: /gallery/style/images/sphx_glr_plot_style_002.png :alt: plot style :srcset: /gallery/style/images/sphx_glr_plot_style_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [] .. GENERATED FROM PYTHON SOURCE LINES 50-52 As you can see, the network is visualised with the "rededge" style (which has red, solid edges) but further modified to have dashed lines. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.049 seconds) .. _sphx_glr_download_gallery_style_plot_style.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_style.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_style.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_style.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_