The βtipsβ graphical dataset is a jointplot, I would like to mark the top 10 outputs (or top-n outliers) on the graph by their indices from the βhourlyβ data frame. I calculate the residual (dotted distance from the midline) to find outliers. Please ignore the merits of this outlier detection method. I just want to annotate the schedule by specification.
import seaborn as sns sns.set(style="darkgrid", color_codes=True) tips = sns.load_dataset("tips") model = pd.ols(y=tips.tip, x=tips.total_bill) tips['resid'] = model.resid

tips.sort_values(by=['resid'], ascending=[False]).tail(5)

%matplotlib inline g = sns.jointplot("total_bill", "tip", data=tips, kind="reg", xlim=(0, 60), ylim=(0, 12), color="r", size=7)
How to annotate the top 10 deviations (the largest 5 and the smallest 5 residuals) on the chart using each point index value (largest residuals) for this:

source share