def _render_dendrogram(dnd, ax, displacement):
<EOL>colors = set()<EOL>for n, (indices, ctype) in enumerate(zip(dnd.groups, dnd.types)):<EOL><INDENT>group = dnd.data[indices[<NUM_LIT:0>]:indices[<NUM_LIT:1>]]<EOL>if n > <NUM_LIT:0>:<EOL><INDENT>displacement += <NUM_LIT:0.5> * (dnd.dims[n - <NUM_LIT:1>][<NUM_LIT:0>] + dnd.dims[n][<NUM_LIT:0>])<EOL><DEDENT>group += (displacement, <NUM_LIT:0.>)<EOL>_generate_collection(group, ax, ctype, colors)<EOL><DEDENT>soma_square = dnd.soma<EOL>if soma_square is not None:<EOL><INDENT>_generate_collection((soma_square + (displacement / <NUM_LIT>, <NUM_LIT:0.>),), ax, NeuriteType.soma, colors)<EOL>ax.plot((displacement / <NUM_LIT>, displacement), (<NUM_LIT:0.>, <NUM_LIT:0.>), color='<STR_LIT:k>')<EOL>ax.plot((<NUM_LIT:0.>, displacement / <NUM_LIT>), (<NUM_LIT:0.>, <NUM_LIT:0.>), color='<STR_LIT:k>')<EOL><DEDENT>return displacement<EOL>
Renders dendrogram