plotly / plotly.R

An interactive graphing library for R
https://plotly-r.com
Other
2.52k stars 621 forks source link

Boxplot outliers not removed. #2305

Open mjdzr opened 8 months ago

mjdzr commented 8 months ago

Hello and thanks a lot for the great package!

I want to delete boxplot outliers as they're duplicates of jitters (but I want to keep the jitters). I have tried to set outlier.[any option] to NA or 0 but still no luck.

Thank you!

library(pacman)
pacman::p_load(dplyr, ggplot2, plotly)

g <- ggplot(chickwts %>% dplyr::filter(feed == "sunflower"),
            aes(x = factor(feed), y = weight, fill = factor(feed))) + 
  geom_boxplot(outlier.shape = NA) + 
  geom_jitter(alpha = 0.5, height = 0)

plot(g)

image

ggplotly(g)

newplot (3)

I apologize if this has been discussed before. Feel free to delete...

LDSamson commented 8 months ago

See this thread. I just posted a workaround function for this specific use case here. I think it is not yet solved in the current plotly version, but correct me if I am wrong.