3D Surface Plot - Changing the x and y axis from categoric data to numeric data

I am trying to plot a 3D surface, using plot_ly on r. I have (x,y,z) coordinates for each point. I have put the x values in a vector, the y values in a vector, and the z values in a matrix (of size x by y).

I’ve used the function: plot_ly(x = distance, y = width, z = elevation) %>% add_surface()

And it gives me:

The z axis is fine however the x and y axes are categoric rather than what my data points are eg. (241, 89, 242.579). How do I solve this?