docs: def _render_dendrogram(dnd, ax, displacement):
      '''Renders dendrogram'''
      # set of unique colors that reflect the set of types of the neurites
      colors = set()
  
      for n, (indices, ctype) in enumerate(zip(dnd.groups, dnd.types)):
  
          # slice rectangles array for the current neurite
          group = dnd.data[indices[0]:indices[1]]
  
          if n > 0:
              # displace the neurites by half of their maximum x dimension
              # plus half of the previous neurite's maxmimum x dimension
              displacement += 0.5 * (dnd.dims[n - 1][0] + dnd.dims[n][0])
  
          # arrange the trees without overlapping with each other
          group += (displacement, 0.)
  
          # create the polygonal collection of the dendrogram
          # segments
          _generate_collection(group, ax, ctype, colors)
  
      soma_square = dnd.soma
  
      if soma_square is not None:
  
          _generate_collection((soma_square + (displacement / 2., 0.),), ax, NeuriteType.soma, colors)
          ax.plot((displacement / 2., displacement), (0., 0.), color='k')
          ax.plot((0., displacement / 2.), (0., 0.), color='k')
  
      return displacement