в конце концов нашел причину, по которой это работает, разместив его, так как я видел, как многие люди борются с этим
library(plotly)
library(reshape2)
#Graph Resolution
graph_reso = 0.05
#Setup Axis
axis_x = seq(min(hobby), max(hobby), by = graph_reso)
axis_y = seq(min(work), max(work), by = graph_reso)
#Sample points
lm_surface = expand.grid(hobby = axis_x,work = axis_y,KEEP.OUT.ATTRS = F)
lm_surface$wellness = predict.lm(lm(wellness ~ work*hobby), newdata = lm_surface)
lm_surface = acast(lm_surface, work ~ hobby, value.var = "wellness")
p_1 = plot_ly(myData, x = ~hobby, y = ~work, z = ~wellness, type = "scatter3d", mode = "markers" )%>% layout(title="Interaction Effect(Work Hours* Hobby Hours) on Wellness")
p_1 = add_trace(p = p_1,
z = lm_surface,
x = axis_x,
y = axis_y,
type = "surface")