9
votes

I have a simple question regarding a 3d scatter plot using the plotly package in R. It appears all of the plots are working with the exception of the 3d scatter and line plots. To test this I've tried the following code (= taken from the cheat sheet):

library(plotly)

plot_ly(type = "scatter3d", x = c(9,8,5,1), y = c(1,2,4,8),z = c(11,8,15,3),
        mode = "markers")

enter image description here

I ended up with a plot containing only the axis and not the actual points. To troubleshoot I've added colors which got me confused as the legend with the color scale did appear but not the points themselves. I did notice the axis have the wrong scale ((80,-80),(60,-60),(100,-100)).

Furthermore, the 3d surface plot en 2d scatter plot examples worked perfectly.

2
could you please include the graph that you get?user7905871

2 Answers

8
votes

(Posted on behalf of the OP).

I reverted to the older package (4.5.6 was found to be working), please find the script below:

require(devtools)
install_version("plotly", version = "4.5.6", repos = "http://cran.us.r-project.org")
0
votes

Is that what you are looking forward? enter image description here

> plot_ly(type = "scatter3d", x = c(9,8,5,1), y = c(1,2,4,8),z = c(11,8,15,3),
+         mode = "markers")

There is no error with your code, clear your R-consel and try again and check the version of the library as well.