I have data with groups. For every group I plot a subplot in plotly. The x-values for all of these subplots correspond to identical description, just the y-axis value is either missing or different across groups. I would like to link these subplots so that if I hover over one point in one subplot, it will also highlight the points with the same x value in other subplots. I have tried the crosstalk package examples, but either I create the subplots wrong or I don't understand how to use it. Does anyone have any experience?
Update:
df <- data.frame(
ID = rep(1:4, times = 2),
Value = rnorm(8),
group = c(1,1,1,1,2,2,2,2)
)
subplot(
plot_ly(df[df$group==1,], x = ~ID, y = ~Value),
plot_ly(df[df$group==2,], x = ~ID, y = ~Value), nrows = 2
)
And my question is, how could I highlight the points with the same x value in all subplots if I hover on one of the points?