1

I would like to have two plotly boxplots side by side using subplot. My problem is that, I cannot get rid of the trace information in the tooltip.

library(plotly)

fig1 <- plot_ly(
  y = list(1,2,3,4,5,6,7,8,9), 
  q1=list(1, 2, 3),
  median=list(4, 5, 6),
  q3=list(7, 8, 9),
  type = "box",
  fillcolor = "#4FA645",
  line = list(color = 'darkgreen'))

fig2 <- fig1

subplot(fig1, fig2) |>   layout(showlegend = F)

I would like to remove the #4FA645 tooltip part. See below.

enter image description here

I figured out so far that this might be achievable by using hovertemplate and pasting an <extra></extra> behind whatever is written there but I did not figure out how to do that.

Roccer
  • 899
  • 2
  • 10
  • 25

1 Answers1

1

Probably not the most elegent solution but I found one myself to solve the problem.

pp <- subplot(fig1, fig2) |> layout(showlegend = F)

pp$x$data[[1]]$name <- " "
pp$x$data[[2]]$name <- " "

pp

This answer and question on stack overflow helped me solve my problem.

Roccer
  • 899
  • 2
  • 10
  • 25