Skip to content

Instantly share code, notes, and snippets.

@Ddedalus
Created October 26, 2019 14:46
Show Gist options
  • Select an option

  • Save Ddedalus/33e91c8abcacc1f698d9f630a59661e7 to your computer and use it in GitHub Desktop.

Select an option

Save Ddedalus/33e91c8abcacc1f698d9f630a59661e7 to your computer and use it in GitHub Desktop.
R+plotly: view data for highlighte points
# 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