The below code used for regression plot and now I am wondering how can I estimate and print some statistical variables such as correlation, s-square and p value on each plot?
The second problem is how can I change plot color? For example how can I convert it from blue to red?
code link: https://colab.research.google.com/drive/1jFy2iCywVQB3Ghq52phZlmGSr7bPFib5?usp=sharing
import numpy as np
import pandas as pd
from google.colab import files
data = files.upload()
from pandas.io import excel
import io
df = pd.read_excel(data['yieldDataset.xlsx'])
df
data1 = df.drop({'Date','class'},1)
from sklearn import preprocessing
names = data1.columns
scalar = preprocessing.MinMaxScaler()
data2 = scalar.fit_transform(data1)
normal = pd.DataFrame(data2, columns = names)
normal['class'] = df['class']
normal
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
sns.pairplot(normal, kind = 'reg')
To your first question, I don't believe Seaborn can calculate correlation coefficients or p-values, but you can use an external package to calculate these (for example, Pandas can do correlation via the corr
DataFrame method) and then annotate your plot.
To the second question, as explained in the docs you can pass arguments the bivariate and univariate plots respectively via the plot
and diagonal
arguments, so in your case:
sns.pairplot(... plot_kws={'color': 'red'}, diag_kws={'color': 'red'})