My data is in format like show in the link.

dt <- read.csv(‘https://raw.githubusercontent.com/plotly/datasets/master/3d-line1.csv’)

I followed the tutorials in the link http://moderndata.plot.ly/3d-surface-plots-with-rstudio-and-plotly/ and also referred to other plotly r examples of 3d surface plots. I am sure there is something I am missing on how to use the z axis data before plotting it, may be it needs further modification or something.

This is what I tried,

x_vec <- matrix(dt$x, nrow = 601, ncol = 1)

y_vec <- matrix(dt$y, nrow = 1, ncol = 601)

z_vec <- matrix(dt$z, nrow = 601, ncol = 601)

plot_ly(x = x_vec, y = y_vec, z = z_vec, type = ‘surface’)

But it resulted in an empty plot.