Hover does not work in ggplot with facets on a shi

2019-09-04 23:42发布

问题:

I have taken an example from here which shows plot brush capabilities on ggplot with facets and changed it to see hover behavior. Any reason why hover does not work with facets?

library(shiny)
library(ggplot2)

runApp(shinyApp(
  ui <- basicPage(
    plotOutput("plot1", hover = "plot_hover", height = 250),
    verbatimTextOutput("info")
  ),
  server = function(input, output) {
    output$plot1 <- renderPlot({
      ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() +
        facet_grid(. ~ cyl) +
        theme_bw()
    })
    output$info <- renderPrint({
      input$plot_hover
    })
  }
))
标签: r ggplot2 shiny