.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/02_matrix_views/plot_06_biclusters.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 or to run this example in your browser via Binder. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_02_matrix_views_plot_06_biclusters.py: Biclusters of the manufacturing space ===================================== Spectral co-clustering finds groups of resources that are used together by groups of activities. Outlined on the seriated incidence matrix (activities in rows, as in the figure of Nagy et al. 2022), the blocks correspond to the transport (AGV) activities, the crimping stations and the assembly stations. Vertex labels are colored by resource type. .. GENERATED FROM PYTHON SOURCE LINES 13-27 .. code-block:: Python import matplotlib.pyplot as plt import hatvis as hv from hatvis.plotting import plot_incidence H = hv.datasets.load_wire_harness() # [snippet:blocks] blocks = hv.seriation.bicluster_blocks(H, n_clusters=6, random_state=0, min_density=0.3) for b in blocks: print(f"{len(b['nodes']):2d} resources x {len(b['edges']):2d} activities, density {b['density']:.2f}:", ", ".join(b["nodes"])) order = hv.seriate(H, "correspondence") # [/snippet:blocks] .. rst-class:: sphx-glr-script-out .. code-block:: none 2 resources x 7 activities, density 0.86: R2, M2 4 resources x 12 activities, density 0.83: O1, AGV, C8, S1 3 resources x 5 activities, density 0.67: O4, R3, D2 8 resources x 15 activities, density 0.42: O2, O5, R5, M1, M3, M4, C7, S3 14 resources x 15 activities, density 0.30: O3, O6, O7, R1, R4, R6, E1, E6, D1, D3, C1, C3, C6, S2 .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: Python fig, ax = plt.subplots(figsize=(7, 12)) plot_incidence(H, order=order, ax=ax, transpose=True, biclusters=blocks, node_groups="type", label_size=6) plt.tight_layout() .. image-sg:: /auto_examples/02_matrix_views/images/sphx_glr_plot_06_biclusters_001.png :alt: plot 06 biclusters :srcset: /auto_examples/02_matrix_views/images/sphx_glr_plot_06_biclusters_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.541 seconds) .. _sphx_glr_download_auto_examples_02_matrix_views_plot_06_biclusters.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/ComplexSystemsIntelligence/hatvis/main?urlpath=lab/tree/notebooks/auto_examples/02_matrix_views/plot_06_biclusters.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_06_biclusters.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_06_biclusters.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_06_biclusters.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_