I am studying the patterns of distribution of whales around specific seabed structures. I am trying to create an interactive 3D plot showing at the same time: <
I believe what you are doing should work fine. I think it might have to do with your x and y coordinates. The surface plot is using 1:ncol(bathy_matrix)
as the x-axis and 1:row(bathy_matrix)
as the y axis points (ticks if you will).
Your points will need to have x and y coordinates in that range for them to show up in the surface plot. Below is a simple example.
set.seed(123)
x = sample(1:ncol(volcano), size = 50)
y = sample(1:nrow(volcano), size = 50)
z = c()
for(i in 1:50) {z <- c(z, volcano[y[i], x[i]])}
df <- data.frame(x, y, z)
plot_ly(z = volcano, type = "surface") %>%
add_trace(data = df, x = x, y = y, z = z, mode = "markers", type = "scatter3d",
marker = list(size = 5, color = "red", symbol = 104))
I get this:
Hope this helps...