#install.packages("plotly") library(plotly) data("mtcars") plot_ly(mtcars,x = ~wt, y = ~mpg, z = ~hp, type = "scatter3d", color = paste(as.factor(mtcars$cyl),"cylinder"))