Add Regression Plane to 3d Scatter Plot in Plotly

后端 未结 4 2013
渐次进展
渐次进展 2020-12-15 08:29

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. Here is an exa

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 09:03

    Replacing the plot part of the code with this, also fixes the error:

    attach(my_df)
    iris_plot <- plot_ly(my_df, 
                         x = ~Sepal.Length, 
                         y = ~Sepal.Width, 
                         z = ~Petal.Length,
                         text = Species, 
                         type = "scatter3d",
                         color = ~Species,
                         colors = c("red","blue","green"),
                         mode = "markers")
    

提交回复
热议问题