.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/style/plot_four_grids.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_four_grids.py: Four grids ========== This example from networkx shows different stylings for the same grid. .. GENERATED FROM PYTHON SOURCE LINES 7-88 .. image-sg:: /gallery/style/images/sphx_glr_plot_four_grids_001.png :alt: plot four grids :srcset: /gallery/style/images/sphx_glr_plot_four_grids_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import networkx as nx import iplotx as ipx G = nx.grid_2d_graph(4, 4) # 4x4 grid pos = nx.spring_layout(G, iterations=100, seed=39775) # Create a 2x2 subplot fig, all_axes = plt.subplots(2, 2) axs = all_axes.flat ipx.plot( G, layout=pos, ax=axs[0], style={ "vertex": { "size": 25, "facecolor": "steelblue", "edgecolor": "none", } }, ) ipx.plot( G, layout=pos, ax=axs[1], style={ "vertex": { "size": 0, } }, ) ipx.plot( G, layout=pos, ax=axs[2], style={ "vertex": { "size": 25, "facecolor": "tab:green", "edgecolor": "tab:gray", }, "edge": { "linewidth": 6, "color": "tab:gray", }, }, ) H = G.to_directed() ipx.plot( H, layout=pos, ax=axs[3], style={ "vertex": { "facecolor": "tab:orange", "edgecolor": "none", "size": 10, }, "edge": { "linewidth": 1.7, "offset": 0, "arrow": { "height": 5, "marker": "|>", }, }, }, ) # Set margins for the axes so that nodes aren't clipped for ax in axs: ax.margins(0.10) fig.tight_layout() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.221 seconds) .. _sphx_glr_download_gallery_style_plot_four_grids.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_four_grids.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_four_grids.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_four_grids.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_