I have a scatter plot with numeric values on both the axis. I want to add two draggable lines, one horizontal and one vertical. Also, I would like to change the color of points in the top-right quadrant formed by the two lines. I could not find any way to do this in R.
My question is similar to Horizontal/Vertical Line in plotly
Two things I want to add is
Ability to drag vertical and horizontal lines
Return values on which the two lines intersect the x and y axis, so that I can use those values as an input for another UI.
My code sample
data <- data.frame(y = sample(0:50, 100, replace = TRUE),
x = round(runif(100),2)
)
plot_ly(data, x = ~x, y = ~y)