# Is it possible to user-define the percentages for lower/upper whisper/fence in BoxWhiskerChart of MMA? [duplicate]

BoxWhiskerChart draws a box-and-whisker summary of the distribution of the input data.

I would like to show the 2nd, 25th, 50th (the median), 75th, and 98th percentages of the input data.

Is it possible to user-define the percentages for lower/upper whisper/fence in BoxWhiskerChart?

data = Table[RandomVariate[NormalDistribution[RandomInteger[5], 1], 100], {2}];
BoxWhiskerChart[data, "Outliers"]

• You want the 2% and 98% to replace the min and max? or to show in addition to them? Feb 24 '16 at 9:54
• A related question. Feb 24 '16 at 9:56
• @JasonB To replace the min and max. Thanks for your answer below. Feb 24 '16 at 12:35

## 1 Answer

Using Brett's answer, we can do it like this

BoxWhiskerChart[data,
Method -> {"BoxRange" -> (Quantile[#, {2/100, 1/4, 1/2, 3/4,
98/100}, {{1/2, 0}, {0, 1}}] &)}] /. {"min" -> "2%",
"max" -> "98%"}


## Problem with Outliers

For some reason changing the "BoxRange" method has the effect of removing some, but not always all, of the plotted outliers,

data = RandomVariate[
NormalDistribution[RandomInteger[5], 1], {5, 100}];
BoxWhiskerChart[data, "Outliers"]
BoxWhiskerChart[data, "Outliers",
Method -> {"BoxRange" -> (Quantile[#, {2/100, 1/4, 1/2, 3/4,
98/100}, {{1/2, 0}, {0, 1}}] &)}] /. {"min" -> "2%",
"max" -> "98%"}


This seems odd to me, because the definition of an outlier from this page would lead me to believe that a data point is an outlier if it is more than 1.5 times the interquartile range (the difference between the 75% and 25% values) lower than the 25% value. Since we didn't change those levels I would naively think the definition of an outlier should remain constant.

• How do you put two bar plots in one figure? - - I reproduce two BoxWhiskerPlots in my System but cannot get them to the same plot. Sep 27 '16 at 10:33