the z3 vector data is produced by prediction from a linear model of x and y so the 3D plot should be a plane. I supplied 4 points from the "corners" of the data ranges for x and y
plotly will only accept a matrix for the z dimension, so I tried a 2X2 for four data points
x3 <- c(25,25,50,50)
y3 <- c(10,80,10,80)
z3[1,1] <- 1030
z3[1,2] <- 1028
z3[2,1] <- 791
z3[2,2] <- 903
plot the plane
plot_ly(x=x3,y=y3,z=z3)%>% add_surface()
I get 2 points with x=25, y=80 and 2 with x=25, y=10 but none with x[3:4] or y[3:4]
the attached plot has another layer of points but I did not think adding all that code and data would help.
3D surface plot with incorrect plane rendering:
How do I decide what dimensions the z data matrix should have based on the number of points I want to plot and the length of the x and y vectors?