Open
Description
library(plotly)
library(shiny)
library(crosstalk)
m <- SharedData$new(mtcars)
ui <- fluidPage(
plotlyOutput("plotID"),
verbatimTextOutput("brushInfo")
)
server <- function(input, output) {
output$plotID <- renderPlotly({
p <- ggplot(m, aes(wt, mpg)) + geom_point()
highlight(ggplotly(p), "plotly_selected")
})
output$brushInfo <- renderPrint({
m$selection()
})
}
shinyApp(ui, server)