Using the mtcars dataset. The x-axis is the time it takes the car to cover a quarter-mile distance. The y-axis is the horsepower the car produces. The z-axis is the weight of the car. The colors are the number of cylinders the car has.
library(plotly)
my_plot <- plot_ly(x = ~mtcars$qsec, y = ~mtcars$hp, z = ~mtcars$wt,
mode = "markers",
type = "scatter3d",
color = ~factor(mtcars$cyl))