Как добавить оттенок для выбросов в морской регблот? - PullRequest
0 голосов
/ 11 июля 2019

Я хочу добавить hue параметр в regplot, чтобы я мог идентифицировать выбросы и дифференцировать их по цветам от остальных на графике, следовательно, после удаления выбросов изменениев регплоте понятнее.

# GrLivArea: Above grade (ground) living area square feet

#Use a 68% confidence interval, which corresponds with the standard error of the estimate:

fig = plt.figure(figsize=(10, 10))

ax1 = fig.add_subplot(211)

b = sns.regplot(x = 'GrLivArea', y = 'SalePrice', data = df_data, ax=ax1,
                 color = 'Green', ci=68, scatter_kws={'alpha':0.3}, line_kws={'color': 'red'})
plt.title ('Ground Living Area VS SalePrice (With Outliers)', fontsize=13)
plt.tight_layout()

# Removing houses which is more than 4000 sq feet
df = df_data.drop(df_data[(df_data['GrLivArea']>4000) & (df_data['SalePrice']<300000)].index)

ax2 = fig.add_subplot(212)
b = sns.regplot(x = 'GrLivArea', y = 'SalePrice', data = df, ax=ax2,
                 color = 'Green', ci=68, scatter_kws={'alpha':0.3}, line_kws={'color': 'red'})
plt.title ('Ground Living Area VS SalePrice (Outliers Removed)', fontsize=13)

plt.tight_layout()
...