library(plotly)
library(datasets)
iris <- datasets::iris
p <- plot_ly(iris, x= ~Sepal.Length, y= ~Sepal.Width, z= ~Petal.Length, color = ~Species,
colors = c("red","green","blue"))
p <- p %>% add_markers() %>% layout(scene = list(xaxis = list(title = 'Sepal.Length'),
yaxis = list(title = 'Sepal.Width'),
zaxis = list(title = 'Petal.Length')))
p