def scatter_regresion_Plot(X, Y, testName):
plt.scatter(X, Y, c = 'b', label = '_nolegend_', s = 1)
X = X.reshape(-1, 1)
Y = Y.reshape(-1, 1)
R2 = r2_score(X, Y)
regr = linear_model.LinearRegression()
regr.fit(X, Y)
plt.plot(X, regr.predict(X), "--", label = 'Regression', color = 'r')
plt.title(testName + ' ($R^2$: ' + "{0:.3f}".format(R2) + ")", fontsize = 14)
plt.xlabel('True Values', fontsize = 12, weight = 'bold')
plt.ylabel('Predicted Values', fontsize = 12, weight = 'bold')
plt.legend(loc = 'upper left', bbox_to_anchor = (0, 1.0), fancybox = True, shadow = True, fontsize = 10)
plt.subplots_adjust(left = 0.2, right = 0.9, bottom = 0.05, top = 0.97, wspace = 0.15, hspace = 0.3)
评论列表
文章目录