Black Lives Matter. Please consider donating to Black Girls Code today.

Boxplot's whiskers' length change when boxpoints option is used


working with plotly boxplot, I have trouble with whiskers size : it’s ok by default, see this example :

plot_ly(ggplot2::diamonds, y = ~price, color = ~cut, type = "box")

But if I want to suppress ouliers from the graph, I try to add boxpoints = FALSE like this :

plot_ly(ggplot2::diamonds, y = ~price, color = ~cut, type = "box",boxpoints=FALSE)

There is no more outliers, but my whiskers are now a lot longer ! How could I suppress ouliers whithout changing my whiskers’ size ?

Hey @Malta,

a bit of a hacky solution may be to use marker color:

plot_ly(ggplot2::diamonds, y = ~price, color = ~cut, type = "box", marker=list(color = "transparent"))

although this is more of a hide than suppress.


yes I thought about that but it isn’t what I want : the main problem I have with outliers is that they change the graph scale so much I can’t even see my boxes; Masking outliers instead of suppressing them would only make thing weird.

It seems boxpoints=False changes the way the whiskers are calculated. See this . I have the same in