Model.plot_voronoi

In [ ]:
Model.plot_voronoi(max_nb_points: int = 50,
                   plot_crosses: bool = True,
                   ax=None, 
                   **style_kwds,)

Draws the Voronoi Graph of the model.

Parameters

Name Type Optional Description
max_nb_points
int
✓
Maximum number of points to display.
plot_crosses
bool
✓
If set to True, the centers are represented by white crosses.
ax
Matplotlib axes object
✓
The axes to plot on.
**style_kwds
any
✓
Any optional parameter to pass to the Matplotlib functions.

Returns

ax : Matplotlib axes object

Example

In [10]:
from verticapy.learn.cluster import KMeans
model = KMeans(name = "public.KMeans_iris")
model.drop()
model.fit("public.iris", 
          ["PetalLengthCm", "PetalWidthCm"],)
# with data points
model.plot_voronoi()
Out[10]:
<module 'matplotlib.pyplot' from '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py'>
In [18]:
# without crosses
model.plot_voronoi(max_nb_points = 1000, plot_crosses=False)
Out[18]:
<module 'matplotlib.pyplot' from '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py'>
In [11]:
# without data points
model.plot_voronoi(max_nb_points = 0)
Out[11]:
<module 'matplotlib.pyplot' from '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py'>