More graceful handling of outliers in plots. Currently supports most of seaborn categorical scatter, distributional and estimate plots.
handle_outliers remove outliers from the plot and show them as text boxes. It can be used with most
seaborn plotting function that works with long-form data as well as
Notable exceptions are:
Please not that only inliers are passed into the plotting function, consequently density estimates and functionals are only computed on that subset and not representative of the whole data.
from outlier_plotting.sns import handle_outliers import seaborn as sns from matplotlib import pyplot as plt plt.title('Showing Outliers') sns.boxplot(data=df, y = 'type', x='value') plt.show() plt.title('With Outlier Handling') handle_outliers(data=df, y = 'type', x='value', plotter=sns.boxplot) plt.show()
For more examples, see examples.ipynb.
The cutoff at which data points are considered outliers can be set as a multiple of the IQR (c.f.
margin) and padding (c.f.
padding) for the text boxes can be changed as well.
conda env create -f environment.yml