这是我的代码和结果,在这里我想添加回归线或者我想查看线性相关性,我尝试了很多方法但我做不到。 你能帮我吗?
import pandas as pd
df = pd.read_csv('/home/beki/Desktop/Final_report9.csv')
df
ax1 = df.plot(kind='scatter', y='log_LUM_Ha', x='log_AGN_LUM(type-2)', color='b', marker = '^', alpha = 0.5 )
ax2 = df.plot(kind='scatter', y='log_Lum_OII', x='log_AGN_LUM(type-2)', color='r', ax=ax1, marker = 's')
ax3 = df.plot(kind='scatter', y='log_LUM_H_beta', x='log_AGN_LUM(type-2)', color='c', ax=ax1, marker = 'x')
ax4 = df.plot(kind='scatter', y='log_LUM_OIII', x='log_AGN_LUM(type-2)', color='g', ax=ax1, marker = 'o')
plt.xlabel('AGN_LUM')
plt.ylabel('Luminosity of emission lines')
plt.legend
plt.title('AGN Luminosity Vs Luminosity of emission lines', weight='bold', size=12)
plt.legend(["log_LUM_Ha", "log_Lum_OII", "log_LUM_H_beta", "log_LUM_OIII"], loc="lower right")
你研究过seaborn的lmplot吗?它可以完成每个变量的散点图,并在点之间应用线性回归线。