def regressionplot(x, y, poly=None):
if not isinstance(x[<NUM_LIT:0>], (float, int, np.float64, np.float32)):<EOL><INDENT>x = [row[<NUM_LIT:0>] for row in x]<EOL><DEDENT>y_regression = poly[<NUM_LIT:0>] * np.array(x) + poly[-<NUM_LIT:1>]<EOL>try:<EOL><INDENT>plt.ion()<EOL>fig = plt.figure()<EOL>ax = fig.add_subplot(<NUM_LIT>)<EOL>plt.plot(x, y_regression, '<STR_LIT>', x, y, '<STR_LIT:o>', markersize=<NUM_LIT:5>)<EOL>plt.legend(['<STR_LIT>' % poly, '<STR_LIT>'])<EOL>ax.grid(True)<EOL>plt.draw()<EOL><DEDENT>except:<EOL><INDENT>logger.warn('<STR_LIT>')<EOL><DEDENT>return y_regression<EOL>
Plot a 2-D linear regression (y = slope * x + offset) overlayed over the raw data samples