INNER CODE UNIT · Python
plot_cluster
TheAlgorithms/Jupyter · machine_learning/dbscan/dbscan.py:98
def plot_cluster(db, clusters, ax):
"""
Extracts all the points in the db and puts them together
as seperate clusters and finally plots them
db cannot be empty
>>> fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(7, 5))
>>> plot_cluster({},[1,2], axes[1] )
Traceback (most recent call last):
...
Exception: db is empty. No points to cluster
clusters cannot be empty
>>> fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(7, 5))
>>> plot_cluster({ (1,2):{'label':'undefined'}, (2,3):{'label':'undefined'}},[],axes[1] )
Traceback (most recent call last):
...
Exception: nothing to cluster. Empty clusters