I have a shinyapp and use plotly-Plots. I have to use webGL, otherwise I do not get an acceptable performance. However it seems, the approach for removing hover here Remove hover info text from a plotly object does not work. My minimal example:
library(shiny)
library(ggplot2)
library(plotly)
ui <- fluidPage(
plotlyOutput("po")
)
server <- function(input, output, session) {
output$po <- renderPlotly({
p <- ggplot(iris)+geom_point(aes(x=Sepal.Width,y=Sepal.Length,color=Species))
p <- toWebGL(p)
#p <- ggplotly(p) # This also does not work, so the problem seems to be somewhere else
p$x$data[[1]]$hoverinfo <- "none"
p
})
}
shinyApp(ui, server)
The hover is still there. How can I remove it?
I stripped away the shiny context as its still an issue you would have in a plain R script. The trick is to adjust the layout's hover option (set to FALSE) ; If theres a lot of text then you could do the optional line to remove the text from the plotly object.
library(ggplot2)
library(plotly)
p <- ggplot(iris)+geom_point(aes(x=Sepal.Width,y=Sepal.Length,color=Species))
p <- toWebGL(p)
p$x$layout$hovermode <- FALSE # This is what you want.
p$x$data[[1]]$text <- NULL # optional ; might make your plotly object smaller
p