Seaborn: Option to hide outliers in a boxplot

Created on 1 Sep 2017  路  8Comments  路  Source: mwaskom/seaborn

Is there a way to not show outliers in boxplot in order to not to mess up a scale?
If not I think It would be nice to add.
I tried fliersize=0 but that didn't work. (The scale was still the same).

Most helpful comment

Adding to @mwaskom's suggestion, I found showfliers=False to be helpful.

All 8 comments

I don't know what "mess up a scale" means but there is

whis : float, optional
   Proportion of the IQR past the low and high quartiles to extend the plot whiskers. Points outside this range will be identified as outliers.

So you could set this to np.inf (or a suitably large number) and the whiskers will extend to the data range.

I was meaning something like this:

In matplotlib this works: https://stackoverflow.com/questions/22028064/matplotlib-boxplot-without-outliers.

I know it can be removed beforehand but just asked if there was a way :)

@scientist1642 you can also just change axis limits (but then you should inform figure audience that there are outliers outside of visible data range).

Or from the docs:

Parameters:
...
kwargs聽: key, value mappings
    Other keyword arguments are passed through to聽plt.boxplot聽at draw time.

Adding to @mwaskom's suggestion, I found showfliers=False to be helpful.

Why showfliers is not documented?

@mapio Well, it doesn't really make sense to try to document all of the arguments the underlying matplotlib function accepts. It would be a duplication of effort and it would inevitably become out of sync as matplotlib changes things (eventually leading to a huge mess when seaborn docs only apply to some versions of matplotlib, etc.). seaborn doesn't do anything specific with showfliers (aside from passing it along to boxplot), so it's not documented. The docs do say:

Other keyword arguments are passed through to plt.boxplot at draw time.

This pattern is used throughout seaborn (and wrapper libraries in general), and it's assumed you can go to the matplotlib docs to find additional options and what they do.

I missed the part "Other keyword arguments are passed through to plt.boxplot at draw time", my fault: you are perfectly right!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vinay-jayaram picture vinay-jayaram  路  3Comments

sungshine picture sungshine  路  3Comments

alexpetralia picture alexpetralia  路  3Comments

Bercio picture Bercio  路  3Comments

tritemio picture tritemio  路  3Comments