Is it possible to have a button in plotlty chart which on clicked would display some text, like an FAQ? I know we can add buttons. But how to add a text display when clicked or hovered on the button.
If your ploy.ly plot is part of a shiny app, shiny has a few options:
Shiny Notifications (notification will appear in the bottom right corner of the browser, remain for 5 seconds, and then fade away)
And then ployly has a nice community here too: https://community.plot.ly/
If you simply need to add text, add a custom button that triggers either a
library(plotly) x <- seq(-2*pi, 2*pi, length.out = 1000) df <- data.frame(x, y = sin(x)) p <- plot_ly(df, x = ~x) %>% add_lines(y = ~y) faq_txt <- list( x = 0, y = 0, text = "Sin starts at 0!" ) layout( p, updatemenus = list( list( type = "buttons", y = 0.8, buttons = list( list( method = "relayout", args = list("annotations", list(faq_txt)), label = "FAQ" ) ) ) ) )