Try to plot this example data use persp and plot_ly and compare:

x <- seq(-1.95, 1.95, length = 30)

y <- seq(-1.95, 1.95, length = 35)

z <- outer(x, y, function(a, b) a*b^2)

persp(x=x, y=y, z=z, theta=-35)

plot_ly(x=~x, y=~y, z=~z) %>% add_surface()

Note that the four corner of z matrix has the same absolute value but different signs, so in persp plot two corners of the surface are of same height and the same for the other two. However, in plotly the four corners have four different heights.

Question: Should these two lines of code be equivalent? If not whatâ€™s the code to generate the same persp plot but allows xy axis show tick label and floating text based on variable x and y? Thanks!!