# \donttest{
library(plotly)
# Sample data
df <- data.frame(
id = 1:5,
value = c(10, 20, 15, 25, 30),
group = c("A", "A", "B", "B", "C")
)
# Create a plotly scatter plot
p <- plot_ly(
data = df,
x = ~value,
y = ~id,
color = ~group
)
# Prepare for linking (adds customdata and source)
p <- prepare_plotly_linking(p, "id", "my_plot")
# Print the plot object (for demonstration)
print(p)
# }
Run the code above in your browser using DataLab