Created
October 26, 2019 14:46
-
-
Save Ddedalus/33e91c8abcacc1f698d9f630a59661e7 to your computer and use it in GitHub Desktop.
R+plotly: view data for highlighte points
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Credit to MLaovie, https://stackoverflow.com/a/50766967/3279307 | |
| library(plotly) | |
| library(crosstalk) # update HTML widgets over a common dataset | |
| library(DT) | |
| sd <- SharedData$new(iris) # put your dataframe here | |
| a <- plot_ly(sd, x = ~Sepal.Width, y = ~Petal.Width) %>% | |
| add_markers(alpha = 0.5) %>% | |
| highlight("plotly_selected", dynamic = TRUE) | |
| # options(persistent = TRUE) # or press Shift | |
| p <- datatable(sd) # displays the data in a table | |
| bscols(widths = c(6, 4), a, p) # two widgets side to side |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment