I am using plotly to plot some plots in my shiny app.
I am using plotly_selected to let the user select some points on the scatterplot.
I want to use the output of that event to plot further graphs in my shiny app. How can I do that?
output$brush <- DT::renderDataTable({
d <- event_data("plotly_selected")
if (!is.null(d)) d
})
This is how I am getting the output of the plotly_selected event in a data frame form.
Now, after the generation of this data table. I want to use this dataset for further plotting.
I tried this way:
output$plot <- renderPlotly({
g <- ggplot(data = d)+
geom_point(aes_string(x= d[,3], y= d[,4]), colour= "red", size = 0.1)
ggplotly(g)
})
})
But, this does not work.