def calculate_and_plot_end_to_end_distance(neurite):
def _dist(seg):<EOL><INDENT>'''<STR_LIT>'''<EOL>return morphmath.point_dist(seg[<NUM_LIT:1>], neurite.root_node.points[<NUM_LIT:0>])<EOL><DEDENT>end_to_end_distance = [_dist(s) for s in nm.iter_segments(neurite)]<EOL>make_end_to_end_distance_plot(np.arange(len(end_to_end_distance)) + <NUM_LIT:1>,<EOL>end_to_end_distance, neurite.type)<EOL>
Calculate and plot the end-to-end distance vs the number of segments for
    an increasingly larger part of a given neurite.

    Note that the plots are not very meaningful for bifurcating trees.