Is there a way to ignore outliers in geom_violin
and have the y axis plot be correlated with the Q1 and Q3 quantiles? (range=1.5
in base R). It would be great if this could be automated (i.e. not just calling out a specific y axis limit).
I see a solution using geom_boxplot here: Ignore outliers in ggplot2 boxplot
But is there a way to replicate this type of solution in geom_violin
? Thanks in advance!
Example code below with desired outcome
library(ggplot2)
Result <- as.numeric(c(.2, .03, .11, .05, .2, .02, .22, 1.1, .02, 120))
Group <- as.factor(c("a", "a", "a", "b", "b", "b", "c", "c", "c", "c"))
x <- data.frame(Result, Group)
plot = ggplot(x, aes(x=Group, y=Result)) +
geom_violin()
print(plot)
Here is the output of the above (not a super helpful graphic):
I'd like something like the plot below using the above data: