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(color)
def _generate_collection ( group , ax , ctype , colors ) : color = TREE_COLOR [ ctype ] collection = PolyCollection ( group , closed = False , antialiaseds = True , edgecolors = 'face' , facecolors = color ) ax . add_collection ( collection ) 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 )
Render rectangle collection