class_docstr: This is a weighted Forest structure, i.e. a tree
  - each node has one parent and children
  (hierarchical structure)
  - some of the nodes can be viewed as leaves, other as roots
  - the edges within a tree are associated with a weight:
  +1 from child to parent
  -1 from parent to child
  - additionally, the nodes have a value, which is called 'height',
  especially useful from dendrograms
  
  members
  -------
  V : (int, >0) the number of vertices
  E : (int) the number of edges
  parents: array of shape (self.V) the parent array
  edges: array of shape (self.E,2) reprensenting pairwise neighbors
  weights, array of shape (self.E), +1/-1 for scending/descending links
  children: list of arrays that represents the childs of any node
  height: array of shape(self.V)
class_docstr_tok: ["This","is","a","weighted","Forest","structure",",","i.e",".","a","tree","-","each","node","has","one","parent","and","children","(","hierarchical","structure",")","-","some","of","the","nodes","can","be","viewed","as","leaves",",","other","as","roots","-","the","edges","within","a","tree","are","associated","with","a","weight",":","+1","from","child","to","parent","-1","from","parent","to","child","-","additionally",",","the","nodes","have","a","value",",","which","is","called","'height","'",",","especially","useful","from","dendrograms","members","--","--","--","-","V",":","(","int",",",">","0",")","the","number","of","vertices","E",":","(","int",")","the","number","of","edges","parents",":","array","of","shape","(","self.V",")","the","parent","array","edges",":","array","of","shape","(","self.E,2",")","reprensenting","pairwise","neighbors","weights",",","array","of","shape","(","self.E",")",",","+1\/-1","for","scending\/descending","links","children",":","list","of","arrays","that","represents","the","childs","of","any","node","height",":","array","of","shape","(","self.V",")"]
docstr: Plot the dendrogram associated with self
  the rank of the data in the dendogram is returned
  
  Parameters
  ----------
  ax: axis handle, optional
  
  Returns
  -------
  ax, the axis handle
docstr_tok: ["Plot","the","dendrogram","associated","with","self","the","rank","of","the","data","in","the","dendogram","is","returned","Parameters","--","--","--","--","--","ax",":","axis","handle",",","optional","Returns","--","--","--","-","ax",",","the","axis","handle"]
code: def plot(self, ax=None):
      """Plot the dendrogram associated with self
      the rank of the data in the dendogram is returned
  
      Parameters
      ----------
      ax: axis handle, optional
  
      Returns
      -------
      ax, the axis handle
      """
      import matplotlib.pyplot as plt
  
      if self.check_compatible_height() == False:
          raise ValueError("cannot plot myself in my current state")
  
      n = np.sum(self.isleaf())
  
      # 1. find a permutation of the leaves that makes it nice
      aux = _label(self.parents)
      temp = np.zeros(self.V)
      rank = np.arange(self.V)
      temp[:n] = np.argsort(aux[:n])
      for i in range(n):
          rank[int(temp[i])] = i
  
      # 2. derive the abscissa in the dendrogram
      idx = np.zeros(self.V)
      temp = np.argsort(rank[:n])
      for i in range(n):
          idx[temp[i]] = i
      for i in range(n, self.V):
          j = np.nonzero(self.parents == i)[0]
          idx[i] = np.mean(idx[j])
  
      # 3. plot
      if ax is None:
          plt.figure()
          ax = plt.subplot(1, 1, 1)
  
      for i in range(self.V):
          h1 = self.height[i]
          h2 = self.height[self.parents[i]]
          plt.plot([idx[i], idx[i]], [h1, h2], "k")
  
      ch = self.get_children()
      for i in range(self.V):
          if np.size(ch[i]) > 0:
              lidx = idx[ch[i]]
              m = lidx.min()
              M = lidx.max()
              h = self.height[i]
              plt.plot([m, M], [h, h], "k")
  
      cM = 1.05 * self.height.max() - 0.05 * self.height.min()
      cm = 1.05 * self.height.min() - 0.05 * self.height.max()
      plt.axis([-1, idx.max() + 1, cm, cM])
      return ax
  
imports: from warnings import warn
  import numpy
  from ..graph.forest import Forest
  from ..graph.graph import WeightedGraph
label_desc: Use image node_id 5 for calling the WeightedForest obj's underlying member method code with example usage: obj.plot(ax) and returns: ax