This is my first time asking a question here so I apologize in advance if I haven't given enough information. I have the following data frame:
Latitude <- c("-108.6125","-108.5114","-108.805","-108.4014","-108.5615",
"-108.8349","-108.225","-108.3139","-108.5568","-108.4968")
Longitude <- c("39.02205","39.22255","39.598","38.89478","39.06429",
"39.27625","39.03","39.1306","39.14823","38.89795")
Depth <- c("60.7735","56.45783","49.65","60.15","50","53.95417",
"50.825","56","55.843","38.73333")
Salinity <- c("35","34","34.5","36","32","33.5","35","34","35","33")
ctd <- data.frame(x = as.numeric(Latitude),
y = as.numeric(Longitude),
z = as.numeric(Depth),
a = as.numeric(Salinity))
I am trying to produce a 3D plot of the variables Latitude, Longitude, Depth, and an environmental parameter (e.g. Salinity/Temperature etc.) from multiple CTD transects. What I am trying to do looks like this:
I have tried using plotly with the plot_ly
function, which is fairly close to what I want:
plot_ly(x=ctd$x, y=ctd$y, z=ctd$z) %>% add_markers(color = ctd$a)
However, I can't work out how to add interpolated data to plotly. I've previously used mba.surf
when only wanting to plot Latitude, Depth, and e.g. Salinity but from what I understand mba.surf only accepts 3 variables.
I hope that makes sense. Thanks in advance!