Can you get rid of the trace labels in the annotations when using ggplotly (ggplot2 with plotly)?

Hi, is it possible to remove the trace labels in the annotations when using ggplotly?

For example:

library(ggplot2)
library(plotly)

g <- ggplot(iris, aes(Sepal.Width, Sepal.Length)) +
  geom_point() +
  annotate("rect", xmin = 4, xmax = 5, ymin = 4, ymax = 5,
           colour = "MediumSeaGreen", fill = "MediumSeaGreen", alpha = 0.3)

ggplotly(g)

Here, how would I get rid of the 'trace 1' when I hover over the green box?

I ran your code.
As a result, there was no label "trace 1".

Thanks @ewhyi . What about when you hover over the green rectangle?

I'm sorry. I could see the label when I hovered over the green square. Sorry for not being of any help.

All good. Thanks for looking anyway.

Answered here: r - Can you get rid of the trace labels in the annotations when using ggplotly (ggplot2 with plotly)? - Stack Overflow

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.