code: def _generate_collection(group, ax, ctype, colors):
      '''Render rectangle collection'''
      color = TREE_COLOR[ctype]
  
      # generate segment collection
      collection = PolyCollection(group, closed=False, antialiaseds=True,
                                  edgecolors='face', facecolors=color)
  
      # add it to the axes
      ax.add_collection(collection)
  
      # dummy plot for the legend
      if color not in colors:
          label = str(ctype).replace('NeuriteType.', '').replace('_', ' ').capitalize()
          ax.plot((0., 0.), (0., 0.), c=color, label=label)
          colors.add(colorf _generate_collection(group, ax, ctype, colors):
      '''Render rectangle collection'''
      color = TREE_COLOR[ctype]
  
      # generate segment collection
      collection = PolyCollection(group, closed=False, antialiaseds=True,
                                  edgecolors='face', facecolors=color)
  
      # add it to the axes
      ax.add_collection(collection)
  
      # dummy plot for the legend
      if color not in colors:
          label = str(ctype).replace('NeuriteType.', '').replace('_', ' ').capitalize()
          ax.plot((0., 0.), (0., 0.), c=color, label=label)
          colors.add(color)
docs: Render rectangle collection