I have developed a shiny app using ggplot2 and plotly, however, the hover text was not correctly showed for two horizontal lines which I added as the upper and lower limits. I want to hide the hover text for these two lines. Does anyone know how to achieve it?
I found one solution but it didn't work for shiny
Disable hover information for a specific layer (geom) of plotly
library(shiny)
shinyServer(
function(input,output,session){
reactivelab <- reactive({
gg <-labn %>% filter(PARCAT2 == input$Group & LBTEST ==
input$Par & SUBJID == input$ID) })
output$labpot <- renderPlotly({
req(nrow(reactivelab()) > 0)
q <- ggplot(data=reactivelab(),aes(x=ADY, y=AVAL))+
geom_point()+geom_line()+
geom_hline(aes(yintercept=ANRLO),linetype="longdash")+
geom_hline(aes(yintercept=ANRHI),linetype="longdash")+
ylab("Lab Standard Value") + xlab("Lab Test Day")
mm <- style(q, text = paste("Lab Parameter:", reactivelab()$PARAM,
"<br>Lab Test Day:", reactivelab()$ADY,
"<br>Lab Standard Value:", reactivelab()$AVAL,
"<br>Normal Range Upper Limit:", reactivelab()$ANRHI,
"<br>Normal Range Lower Limit:", reactivelab()$ANRLO
), hoverinfo = "text")})
})