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

Display more than 2 decimal places in plotly boxplot

options(digits = 4) does not have any effect on the number of decimal places in a boxplot’s hover info; numbers are still rounded to 2 digits. Please see the following examples

Hi @PeterRowan

Try using hoverformat = '.4f' For example,


dat <- data.frame(cond = factor(rep(c("A","B"), each=200)), rating = c(rnorm(200),rnorm(200, mean=.8)))

p <- ggplot(dat, aes(x=cond, y=rating)) + geom_boxplot()

p <- ggplotly(p) %>% layout(yaxis = list(hoverformat = '.4f'))

Hi Branden,

Thank you so much. It works as expected.