I am learning shiny's interactive plots, using plotOutput(click=xxx, brush=yyy) with ggplot.
# facet_grid(. ~ cyl) +
interactive chart stops working as it fails to detect mouse clicks or brush actions.
I am using ggplot2 v2.0.0 and shiny v0.12.2
Appreciate your help!
library(ggplot2)
library(shiny)
ui <- basicPage(
plotOutput("plot1", brush = "plot_brush", click = "plot_click", height = 250),
verbatimTextOutput("info"),
verbatimTextOutput("info2")
)
server <- function(input, output) {
output$plot1 <- renderPlot({
ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() +
#facet_grid(. ~ cyl) +
theme_bw()
})
output$info <- renderPrint({
brushedPoints(mtcars, input$plot_brush)
})
output$info2 <- renderPrint({
nearPoints(mtcars, input$plot_click)
})
}
shinyApp(ui, server)