Home > Software engineering >  How do I include outlier points in the boxplot min and max range?
How do I include outlier points in the boxplot min and max range?

Time:07-17

enter image description here

For WT_C57BL6, the boxplot is reading the bottom points as outliers. I want the boxplot min range to be extended to those "outlier" points and see the different quartile and mean placement. I basically want the lower points to not be seen as outliers. How do I do that?

I am using the ggplot and geom_boxplot/geom_jitter function to create my figure.

CodePudding user response:

Points are plotted as "outliers", when they are beyond 1.5 times the interquartile range (IQR). This can be adjusted with the coef parameter, which is 1.5 by default. Increasing it will include more points.

For example, compare

ggplot(mtcars, aes(factor(cyl), hp))   geom_boxplot()

with

ggplot(mtcars, aes(factor(cyl), hp))   geom_boxplot(coef = Inf)
  • Related