I am trying to run these functions to establish a 3D plot and I want to add a plane but an error occurs.
plot_ly(data = df, z = ~PM, x = ~Wind_speed, y = ~SO2, opacity = 0.5) %>%
add_markers()
x <- seq(370, 15000, by = 10)
y <- seq(0, 15000, by = 10)
plane <- outer(x, y, function(a, b){fit$coef[1] +
fit$coef[2]*a + fit$coef[3]*b})
add_surface(x = ~x, y = ~y, z = ~plane, showscale = FALSE)
but then this error shows up
> add_surface(x = ~x, y = ~y, z = ~plane, showscale = FALSE)
Error in add_trace_classed(p, class = "plotly_surface", z = z, type = "surface", :
argument "p" is missing, with no default
What should I do to fix this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…