code: def plot(
      X,
      labels,
      probabilities=None,
      parameters=None,
      ground_truth=False,
      ax=None,
  ):
      if ax is None:
          _, ax = plt.subplots(figsize=(10, 4))
      labels = labels if labels is not None else np.ones(X.shape[0])
      probabilities = (
          probabilities
          if probabilities is not None
          else np.ones(X.shape[0])
      )
      # Black removed and is used for noise instead.
      unique_labels = set(labels)
      colors = [
          plt.cm.Spectral(each)
          for each in np.linspace(0, 1, len(unique_labels))
      ]
      # The probability of a point belonging to its labeled cluster determines
      # the size of its marker
      proba_map = {
          idx: probabilities[idx] for idx in range(len(labels))
      }
      for k, col in zip(unique_labels, colors):
          if k == -1:
              # Black used for noise.
              col = [0, 0, 0, 1]
  
          class_index = np.where(labels == k)[0]
          for ci in class_index:
              ax.plot(
                  X[ci, 0],
                  X[ci, 1],
                  "x" if k == -1 else "o",
                  markerfacecolor=tuple(col),
                  markeredgecolor="k",
                  markersize=4 if k == -1 else 1 + 5 * proba_map[ci],
              )
      n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)
      preamble = "True" if ground_truth else "Estimated"
      title = f"{preamble} number of clusters: {n_clusters_}"
      if parameters is not None:
          parameters_str = ", ".join(
              f"{k}={v}" for k, v in parameters.items()
          )
          title += f" | {parameters_str}"
      ax.set_title(title)
      plt.tight_layout()
  
imports: import matplotlib.pyplot
  import numpy
  from sklearn.cluster import DBSCAN, HDBSCAN
  from sklearn.datasets import make_blobs
label_desc: Use image node_id 1 for calling a global function with example usage: plot(X, labels, probabilities, parameters, ground_truth, ax) without return types