class_docstr: The condensed tree structure, which provides a simplified or smoothed version
  of the :class:`~hdbscan.plots.SingleLinkageTree`.
  
  Parameters
  ----------
  condensed_tree_array : numpy recarray from :class:`~hdbscan.HDBSCAN`
      The raw numpy rec array version of the condensed tree as produced
      internally by hdbscan.
  
  cluster_selection_method : string, optional (default 'eom')
      The method of selecting clusters. One of 'eom' or 'leaf'
  
  allow_single_cluster : Boolean, optional (default False)
      Whether to allow the root cluster as the only selected cluster
class_docstr_tok: ["The","condensed","tree","structure",",","which","provides","a","simplified","or","smoothed","version","of","the",":","class",":","`","~hdbscan.plots.SingleLinkageTree","`",".","Parameters","--","--","--","--","--","condensed_tree_array",":","numpy","recarray","from",":","class",":","`","~hdbscan.HDBSCAN","`","The","raw","numpy","rec","array","version","of","the","condensed","tree","as","produced","internally","by","hdbscan",".","cluster_selection_method",":","string",",","optional","(","default","'eom","'",")","The","method","of","selecting","clusters",".","One","of","'eom","'","or","'leaf'","allow_single_cluster",":","Boolean",",","optional","(","default","False",")","Whether","to","allow","the","root","cluster","as","the","only","selected","cluster"]
docstr: Use matplotlib to plot an 'icicle plot' dendrogram of the condensed tree.
  
  Effectively this is a dendrogram where the width of each cluster bar is
  equal to the number of points (or log of the number of points) in the cluster
  at the given lambda value. Thus bars narrow as points progressively drop
  out of clusters. The make the effect more apparent the bars are also colored
  according the the number of points (or log of the number of points).
  
  Parameters
  ----------
  leaf_separation : float, optional (default 1)
                    How far apart to space the final leaves of the
                    dendrogram.
  
  cmap : string or matplotlib colormap, optional (default viridis)
         The matplotlib colormap to use to color the cluster bars.
  
  
  select_clusters : boolean, optional (default False)
                    Whether to draw ovals highlighting which cluster
                    bar represent the clusters that were selected by
                    HDBSCAN as the final clusters.
  
  label_clusters : boolean, optional (default False)
                   If select_clusters is True then this determines
                   whether to draw text labels on the clusters.
  
  selection_palette : list of colors, optional (default None)
                      If not None, and at least as long as
                      the number of clusters, draw ovals
                      in colors iterating through this palette.
                      This can aid in cluster identification
                      when plotting.
  
  axis : matplotlib axis or None, optional (default None)
         The matplotlib axis to render to. If None then a new axis
         will be generated. The rendered axis will be returned.
  
  
  colorbar : boolean, optional (default True)
             Whether to draw a matplotlib colorbar displaying the range
             of cluster sizes as per the colormap.
  
  log_size : boolean, optional (default False)
             Use log scale for the 'size' of clusters (i.e. number of
             points in the cluster at a given lambda value).
  
  
  max_rectangles_per_icicle : int, optional (default 20)
      To simplify the plot this method will only emit
      ``max_rectangles_per_icicle`` bars per branch of the dendrogram.
      This ensures that we don't suffer from massive overplotting in
      cases with a lot of data points.
  
   Returns
  -------
  axis : matplotlib axis
         The axis on which the 'icicle plot' has been rendered.
docstr_tok: ["Use","matplotlib","to","plot","an","'icicle","plot","'","dendrogram","of","the","condensed","tree",".","Effectively","this","is","a","dendrogram","where","the","width","of","each","cluster","bar","is","equal","to","the","number","of","points","(","or","log","of","the","number","of","points",")","in","the","cluster","at","the","given","lambda","value",".","Thus","bars","narrow","as","points","progressively","drop","out","of","clusters",".","The","make","the","effect","more","apparent","the","bars","are","also","colored","according","the","the","number","of","points","(","or","log","of","the","number","of","points",")",".","Parameters","--","--","--","--","--","leaf_separation",":","float",",","optional","(","default","1",")","How","far","apart","to","space","the","final","leaves","of","the","dendrogram",".","cmap",":","string","or","matplotlib","colormap",",","optional","(","default","viridis",")","The","matplotlib","colormap","to","use","to","color","the","cluster","bars",".","select_clusters",":","boolean",",","optional","(","default","False",")","Whether","to","draw","ovals","highlighting","which","cluster","bar","represent","the","clusters","that","were","selected","by","HDBSCAN","as","the","final","clusters",".","label_clusters",":","boolean",",","optional","(","default","False",")","If","select_clusters","is","True","then","this","determines","whether","to","draw","text","labels","on","the","clusters",".","selection_palette",":","list","of","colors",",","optional","(","default","None",")","If","not","None",",","and","at","least","as","long","as","the","number","of","clusters",",","draw","ovals","in","colors","iterating","through","this","palette",".","This","can","aid","in","cluster","identification","when","plotting",".","axis",":","matplotlib","axis","or","None",",","optional","(","default","None",")","The","matplotlib","axis","to","render","to",".","If","None","then","a","new","axis","will","be","generated",".","The","rendered","axis","will","be","returned",".","colorbar",":","boolean",",","optional","(","default","True",")","Whether","to","draw","a","matplotlib","colorbar","displaying","the","range","of","cluster","sizes","as","per","the","colormap",".","log_size",":","boolean",",","optional","(","default","False",")","Use","log","scale","for","the","'size","'","of","clusters","(","i.e",".","number","of","points","in","the","cluster","at","a","given","lambda","value",")",".","max_rectangles_per_icicle",":","int",",","optional","(","default","20",")","To","simplify","the","plot","this","method","will","only","emit","``","max_rectangles_per_icicle","``","bars","per","branch","of","the","dendrogram",".","This","ensures","that","we","do","n't","suffer","from","massive","overplotting","in","cases","with","a","lot","of","data","points",".","Returns","--","--","--","-","axis",":","matplotlib","axis","The","axis","on","which","the","'icicle","plot","'","has","been","rendered","."]
code: def plot(
      self,
      leaf_separation=1,
      cmap="viridis",
      select_clusters=False,
      label_clusters=False,
      selection_palette=None,
      axis=None,
      colorbar=True,
      log_size=False,
      max_rectangles_per_icicle=20,
  ):
      """Use matplotlib to plot an 'icicle plot' dendrogram of the condensed tree.
  
      Effectively this is a dendrogram where the width of each cluster bar is
      equal to the number of points (or log of the number of points) in the cluster
      at the given lambda value. Thus bars narrow as points progressively drop
      out of clusters. The make the effect more apparent the bars are also colored
      according the the number of points (or log of the number of points).
  
      Parameters
      ----------
      leaf_separation : float, optional (default 1)
                        How far apart to space the final leaves of the
                        dendrogram.
  
      cmap : string or matplotlib colormap, optional (default viridis)
             The matplotlib colormap to use to color the cluster bars.
  
  
      select_clusters : boolean, optional (default False)
                        Whether to draw ovals highlighting which cluster
                        bar represent the clusters that were selected by
                        HDBSCAN as the final clusters.
  
      label_clusters : boolean, optional (default False)
                       If select_clusters is True then this determines
                       whether to draw text labels on the clusters.
  
      selection_palette : list of colors, optional (default None)
                          If not None, and at least as long as
                          the number of clusters, draw ovals
                          in colors iterating through this palette.
                          This can aid in cluster identification
                          when plotting.
  
      axis : matplotlib axis or None, optional (default None)
             The matplotlib axis to render to. If None then a new axis
             will be generated. The rendered axis will be returned.
  
  
      colorbar : boolean, optional (default True)
                 Whether to draw a matplotlib colorbar displaying the range
                 of cluster sizes as per the colormap.
  
      log_size : boolean, optional (default False)
                 Use log scale for the 'size' of clusters (i.e. number of
                 points in the cluster at a given lambda value).
  
  
      max_rectangles_per_icicle : int, optional (default 20)
          To simplify the plot this method will only emit
          ``max_rectangles_per_icicle`` bars per branch of the dendrogram.
          This ensures that we don't suffer from massive overplotting in
          cases with a lot of data points.
  
       Returns
      -------
      axis : matplotlib axis
             The axis on which the 'icicle plot' has been rendered.
      """
      try:
          import matplotlib.pyplot as plt
      except ImportError:
          raise ImportError(
              "You must install the matplotlib library to plot the condensed tree."
              "Use get_plot_data to calculate the relevant data without plotting."
          )
  
      plot_data = self.get_plot_data(
          leaf_separation=leaf_separation,
          log_size=log_size,
          max_rectangle_per_icicle=max_rectangles_per_icicle,
      )
  
      if cmap != "none":
          sm = plt.cm.ScalarMappable(
              cmap=cmap,
              norm=plt.Normalize(0, max(plot_data["bar_widths"])),
          )
          sm.set_array(plot_data["bar_widths"])
          bar_colors = [sm.to_rgba(x) for x in plot_data["bar_widths"]]
      else:
          bar_colors = "black"
  
      if axis is None:
          axis = plt.gca()
  
      axis.bar(
          plot_data["bar_centers"],
          plot_data["bar_tops"],
          bottom=plot_data["bar_bottoms"],
          width=plot_data["bar_widths"],
          color=bar_colors,
          align="center",
          linewidth=0,
      )
  
      drawlines = []
      for xs, ys in zip(plot_data["line_xs"], plot_data["line_ys"]):
          drawlines.append(xs)
          drawlines.append(ys)
      axis.plot(*drawlines, color="black", linewidth=1)
      # for xs, ys in zip(plot_data['line_xs'], plot_data['line_ys']):
      #     axis.plot(xs, ys, color='black', linewidth=1)
  
      if select_clusters:
          try:
              from matplotlib.patches import Ellipse
          except ImportError:
              raise ImportError(
                  "You must have matplotlib.patches available to plot selected clusters."
              )
  
          chosen_clusters = self._select_clusters()
  
          # Extract the chosen cluster bounds. If enough duplicate data points exist in the
          # data the lambda value might be infinite. This breaks labeling and highlighting
          # the chosen clusters.
          cluster_bounds = np.array(
              [plot_data["cluster_bounds"][c] for c in chosen_clusters]
          )
          if not np.isfinite(cluster_bounds).all():
              warn(
                  "Infinite lambda values encountered in chosen clusters."
                  " This might be due to duplicates in the data."
              )
  
          # Extract the plot range of the y-axis and set default center and height values for ellipses.
          # Extremly dense clusters might result in near infinite lambda values. Setting max_height
          # based on the percentile should alleviate the impact on plotting.
          plot_range = np.hstack(
              [plot_data["bar_tops"], plot_data["bar_bottoms"]]
          )
          plot_range = plot_range[np.isfinite(plot_range)]
          mean_y_center = np.mean(
              [np.max(plot_range), np.min(plot_range)]
          )
          max_height = np.diff(np.percentile(plot_range, q=[10, 90]))
  
          for i, c in enumerate(chosen_clusters):
              c_bounds = plot_data["cluster_bounds"][c]
              width = c_bounds[CB_RIGHT] - c_bounds[CB_LEFT]
              height = c_bounds[CB_TOP] - c_bounds[CB_BOTTOM]
              center = (
                  np.mean([c_bounds[CB_LEFT], c_bounds[CB_RIGHT]]),
                  np.mean([c_bounds[CB_TOP], c_bounds[CB_BOTTOM]]),
              )
  
              # Set center and height to default values if necessary
              if not np.isfinite(center[1]):
                  center = (center[0], mean_y_center)
              if not np.isfinite(height):
                  height = max_height
  
              # Ensure the ellipse is visible
              min_height = 0.1 * max_height
              if height < min_height:
                  height = min_height
  
              if selection_palette is not None and len(
                  selection_palette
              ) >= len(chosen_clusters):
                  oval_color = selection_palette[i]
              else:
                  oval_color = "r"
  
              box = Ellipse(
                  center,
                  2.0 * width,
                  1.2 * height,
                  facecolor="none",
                  edgecolor=oval_color,
                  linewidth=2,
              )
  
              if label_clusters:
                  axis.annotate(
                      str(i),
                      xy=center,
                      xytext=(
                          center[0] - 4.0 * width,
                          center[1] + 0.65 * height,
                      ),
                      horizontalalignment="left",
                      verticalalignment="bottom",
                  )
  
              axis.add_artist(box)
  
      if colorbar:
          cb = plt.colorbar(sm, ax=axis)
          if log_size:
              cb.ax.set_ylabel("log(Number of points)")
          else:
              cb.ax.set_ylabel("Number of points")
  
      axis.set_xticks([])
      for side in ("right", "top", "bottom"):
          axis.spines[side].set_visible(False)
      axis.invert_yaxis()
      axis.set_ylabel("$\lambda$ value")
  
      return axis
  
imports: import numpy
  from scipy.cluster.hierarchy import dendrogram
  from sklearn.manifold import TSNE
  from sklearn.decomposition import PCA
  from sklearn.metrics import pairwise_distances
  from warnings import warn
  from ._hdbscan_tree import compute_stability, labelling_at_cut, recurse_leaf_dfs
label_desc: Use image node_id 4 for calling the CondensedTree obj's underlying member method code with example usage: obj.plot(leaf_separation, cmap, select_clusters, label_clusters, selection_palette, axis, colorbar, log_size, max_rectangles_per_icicle) and returns: axis