I am looking to take advantage of the awesome features in Plotly but I am having a hard time figuring out how to add a regression plane to a 3d scatter plot. I know how to get the scatter plot started, does anyone know how to take it the next step and add the plane based on the linear model?
library(plotly)
data(iris)
iris_plot <- plot_ly(my_df,
x = Sepal.Length,
y = Sepal.Width,
z = Petal.Length,
type = "scatter3d",
mode = "markers")
petal_lm <- lm(Petal.Length ~ 0 + Sepal.Length + Sepal.Width,
Thanks!