.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/110_network_layouts.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_auto_examples_110_network_layouts.py: Network Layouts =============== Related MassComposition objects can be represented in network using the Flowsheet object. This example demonstrates layouts of such networks. .. GENERATED FROM PYTHON SOURCE LINES 10-20 .. code-block:: default import plotly import pandas as pd from elphick.mass_composition.flowsheet import Flowsheet from elphick.mass_composition.datasets.sample_data import size_by_assay from elphick.mass_composition import MassComposition # sphinx_gallery_thumbnail_number = -1 .. GENERATED FROM PYTHON SOURCE LINES 21-25 Create a mass-composition object -------------------------------- We get some demo data in the form of a pandas DataFrame .. GENERATED FROM PYTHON SOURCE LINES 26-30 .. code-block:: default df_data: pd.DataFrame = size_by_assay() .. GENERATED FROM PYTHON SOURCE LINES 31-32 Create the object .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. code-block:: default mc_feed: MassComposition = MassComposition(df_data, name='feed') .. GENERATED FROM PYTHON SOURCE LINES 37-39 Split the Sample ---------------- .. GENERATED FROM PYTHON SOURCE LINES 39-45 .. code-block:: default mc_1, mc_2 = mc_feed.split(0.5, 'split 1', 'split 2') mc_3, mc_4 = mc_1.split(0.5, 'split 3', 'split 4') mc_5, mc_6 = mc_2.split(0.5, 'split 5', 'split 6') .. GENERATED FROM PYTHON SOURCE LINES 46-47 Create a network and plot with both orientations .. GENERATED FROM PYTHON SOURCE LINES 48-56 .. code-block:: default fs: Flowsheet = Flowsheet().from_streams([mc_feed, mc_1, mc_2, mc_3, mc_4, mc_5, mc_6]) fig = fs.plot_network(orientation='horizontal') fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 57-60 .. code-block:: default fig = fs.plot_network(orientation='vertical') fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 61-62 The table plot also supports orientation with the network_orientation argument. .. GENERATED FROM PYTHON SOURCE LINES 63-67 .. code-block:: default fig = fs.table_plot(table_pos='left', plot_type='network', network_orientation='vertical') # noinspection PyTypeChecker plotly.io.show(fig) # this call to show will set the thumbnail for use in the gallery .. raw:: html :file: images/sphx_glr_110_network_layouts_001.html .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.183 seconds) .. _sphx_glr_download_auto_examples_110_network_layouts.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 110_network_layouts.py <110_network_layouts.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 110_network_layouts.ipynb <110_network_layouts.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_