code: def create_dendrogram(
      X,
      orientation="bottom",
      labels=None,
      colorscale=None,
      distfun=None,
      linkagefun=lambda x: sch.linkage(x, "complete"),
      hovertext=None,
      color_threshold=None,
  ):
      """
      Function that returns a dendrogram Plotly figure object. This is a thin
      wrapper around scipy.cluster.hierarchy.dendrogram.
  
      See also https://dash.plot.ly/dash-bio/clustergram.
  
      :param (ndarray) X: Matrix of observations as array of arrays
      :param (str) orientation: 'top', 'right', 'bottom', or 'left'
      :param (list) labels: List of axis category labels(observation labels)
      :param (list) colorscale: Optional colorscale for the dendrogram tree.
                                Requires 8 colors to be specified, the 7th of
                                which is ignored.  With scipy>=1.5.0, the 2nd, 3rd
                                and 6th are used twice as often as the others.
                                Given a shorter list, the missing values are
                                replaced with defaults and with a longer list the
                                extra values are ignored.
      :param (function) distfun: Function to compute the pairwise distance from
                                 the observations
      :param (function) linkagefun: Function to compute the linkage matrix from
                                 the pairwise distances
      :param (list[list]) hovertext: List of hovertext for constituent traces of dendrogram
                                 clusters
      :param (double) color_threshold: Value at which the separation of clusters will be made
  
      Example 1: Simple bottom oriented dendrogram
  
      >>> from plotly.figure_factory import create_dendrogram
  
      >>> import numpy as np
  
      >>> X = np.random.rand(10,10)
      >>> fig = create_dendrogram(X)
      >>> fig.show()
  
      Example 2: Dendrogram to put on the left of the heatmap
  
      >>> from plotly.figure_factory import create_dendrogram
  
      >>> import numpy as np
  
      >>> X = np.random.rand(5,5)
      >>> names = ['Jack', 'Oxana', 'John', 'Chelsea', 'Mark']
      >>> dendro = create_dendrogram(X, orientation='right', labels=names)
      >>> dendro.update_layout({'width':700, 'height':500}) # doctest: +SKIP
      >>> dendro.show()
  
      Example 3: Dendrogram with Pandas
  
      >>> from plotly.figure_factory import create_dendrogram
  
      >>> import numpy as np
      >>> import pandas as pd
  
      >>> Index= ['A','B','C','D','E','F','G','H','I','J']
      >>> df = pd.DataFrame(abs(np.random.randn(10, 10)), index=Index)
      >>> fig = create_dendrogram(df, labels=Index)
      >>> fig.show()
      """
      if not scp or not scs or not sch:
          raise ImportError(
              "FigureFactory.create_dendrogram requires scipy, \
                              scipy.spatial and scipy.hierarchy"
          )
  
      s = X.shape
      if len(s) != 2:
          exceptions.PlotlyError("X should be 2-dimensional array.")
  
      if distfun is None:
          distfun = scs.distance.pdist
  
      dendrogram = _Dendrogram(
          X,
          orientation,
          labels,
          colorscale,
          distfun=distfun,
          linkagefun=linkagefun,
          hovertext=hovertext,
          color_threshold=color_threshold,
      )
  
      return graph_objs.Figure(
          data=dendrogram.data, layout=dendrogram.layout
      )
  
file_path: catboost/contrib/python/plotly/py2/plotly/figure_factory/_dendrogram.py
imports: from __future__ import absolute_import
  from collections import OrderedDict
  from plotly import exceptions, optional_imports
  from plotly.graph_objs import graph_objs
label_desc: Use image node_id 1 for calling a global function with example usage: create_dendrogram(X, orientation, labels, colorscale, distfun, linkagefun, hovertext, color_threshold) and returns: graph_objs