Seaborn: annotate the linear regression equation

You can use coefficients of linear fit to make a legend like in this example: import seaborn as sns import matplotlib.pyplot as plt from scipy import stats tips = sns.load_dataset(“tips”) # get coeffs of linear fit slope, intercept, r_value, p_value, std_err = stats.linregress(tips[‘total_bill’],tips[‘tip’]) # use line_kws to set line label for legend ax = sns.regplot(x=”total_bill”, … Read more