Toggle all trace on/off in ggplotly()

How can I toggle "all traces" on / off in ggplotly() by 1-click ? I would appreciate any comments!!

a <- seq(-10, 10)

data.frame(a=a, name=as.factor(a)) %>%
    ggplot(aes(x=a, y=a, color=name)) +
    geom_point() -> g

saveWidget(ggplotly(g), './tmp.html')

you need to modify the initial state of the traces using plotly _build or avoiding to use ggplotly and use plotly directly.

Thanks, I will try plotly_build!

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.