def smooth_line(line, smoothing=<NUM_LIT:1>, trim=True, draw=True):
<EOL>xdata = list(line.get_xdata())<EOL>ydata = list(line.get_ydata())<EOL>_fun.smooth_array(ydata, smoothing)<EOL>if trim:<EOL><INDENT>for n in range(<NUM_LIT:0>, smoothing):<EOL><INDENT>xdata.pop(<NUM_LIT:0>); xdata.pop(-<NUM_LIT:1>)<EOL>ydata.pop(<NUM_LIT:0>); ydata.pop(-<NUM_LIT:1>)<EOL><DEDENT><DEDENT>if len(ydata) == <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>"+str(line)+"<STR_LIT:!>")<EOL><DEDENT>else:<EOL><INDENT>line.set_data(xdata, ydata)<EOL><DEDENT>if draw: _pylab.draw()<EOL>
This takes a line instance and smooths its data with nearest neighbor averaging.