.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/utils/plot_voronoi.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_utils_plot_voronoi.py: ============================================= Plot Voronoi ============================================= Plots the Voronoi diagram of the K-Means clusters overlaid with the data .. GENERATED FROM PYTHON SOURCE LINES 8-11 .. code-block:: Python # License: BSD-3-clause # Author: K.Laurent .. GENERATED FROM PYTHON SOURCE LINES 12-13 Import required modules .. GENERATED FROM PYTHON SOURCE LINES 13-18 .. code-block:: Python import matplotlib.pyplot as plt import watex as wx from sklearn.datasets import make_moons from watex.utils import plot_voronoi .. GENERATED FROM PYTHON SOURCE LINES 19-20 Plot the Voronoi function .. GENERATED FROM PYTHON SOURCE LINES 20-23 .. code-block:: Python fig,ax = plt.subplots ( 1, figsize = ( 10, 5 )) X, y = make_moons (n_samples=5000, noise=0.3) km = wx.sklearn.KMeans (n_clusters = 300, n_init ='auto').fit(X, y ) plot_voronoi ( X, y , cluster_centers = km.cluster_centers_, ax = ax , ) .. image-sg:: /glr_examples/utils/images/sphx_glr_plot_voronoi_001.png :alt: plot voronoi :srcset: /glr_examples/utils/images/sphx_glr_plot_voronoi_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.654 seconds) .. _sphx_glr_download_glr_examples_utils_plot_voronoi.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/utils/plot_voronoi.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_voronoi.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_voronoi.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_