2020-12-04

How to remove whiskers in a boxplot in ggplot2

Title

Problem

We want to remove whiskers in a boxplot created with ggplot2.

library(ggplot2)
p <- ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_boxplot()

Solution

We specify coef = 0, overwriting the default value (coef = 1.5).

p <- ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_boxplot(outlier.size = 0, coef = 0)

Related posts

No hay comentarios:

Publicar un comentario

Nube de datos