.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/view/plot_dendrogram.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_glr_examples_view_plot_dendrogram.py: ================================================= Plot dendrogram ================================================= visualizes specific features on a dendrogram diagram .. GENERATED FROM PYTHON SOURCE LINES 8-11 .. code-block:: Python # Author: L.Kouadio # Licence: BSD-3-clause .. GENERATED FROM PYTHON SOURCE LINES 12-17 Use the Iris dataset from :func:`~watex.datasets.load_iris` and return :class:`~watex.utils.box.Boxspace` objects where the the frame , feature_names and target_names are the attributes. Thus, rather than creating new columns to pass as`colums` arguments, we uses the `feature_names` attribute instead: .. GENERATED FROM PYTHON SOURCE LINES 17-23 .. code-block:: Python from watex.datasets import load_iris from watex.view import plotDendrogram data = load_iris () # return a box data objet # print the five row of the iris dataframe print(data.frame.head()) .. rst-class:: sphx-glr-script-out .. code-block:: none sepal length (cm) sepal width (cm) ... petal width (cm) target 0 5.1 3.5 ... 0.2 0 1 4.9 3.0 ... 0.2 0 2 4.7 3.2 ... 0.2 0 3 4.6 3.1 ... 0.2 0 4 5.0 3.6 ... 0.2 0 [5 rows x 5 columns] .. GENERATED FROM PYTHON SOURCE LINES 24-25 Print the feature names .. GENERATED FROM PYTHON SOURCE LINES 25-27 .. code-block:: Python print(data.feature_names ) .. rst-class:: sphx-glr-script-out .. code-block:: none ['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', 'petal width (cm)'] .. GENERATED FROM PYTHON SOURCE LINES 28-29 Plot the dendrogram .. GENERATED FROM PYTHON SOURCE LINES 29-29 .. code-block:: Python plotDendrogram (data.frame, columns =data.feature_names[:2] ) .. image-sg:: /glr_examples/view/images/sphx_glr_plot_dendrogram_001.png :alt: plot dendrogram :srcset: /glr_examples/view/images/sphx_glr_plot_dendrogram_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.294 seconds) .. _sphx_glr_download_glr_examples_view_plot_dendrogram.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/watex/watex/0.3.X?urlpath=lab/tree/notebooks/glr_examples/view/plot_dendrogram.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dendrogram.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dendrogram.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_