Set-up

install.packages("plotly",repos = "http://cran.us.r-project.org")
## Installing package into '/Users/tsendo/Library/R/3.3/library'
## (as 'lib' is unspecified)
## 
##   There is a binary version available but the source version is
##   later:
##        binary source needs_compilation
## plotly  4.5.6  4.6.0             FALSE
## installing the source package 'plotly'
library(plotly)
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.3.2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

Create a 3-D plot

This is to create a three-dimentional data plot of mtcars data using ploty functionality. Where mpg is plotted as height as explained by Weight(x-axisis) and HP(y-axisis),

plot_ly(mtcars, x = ~wt, y = ~hp, z = ~mpg, color=~factor(cyl)) %>%
  add_markers() %>%
  layout(scene = list(xaxis = list(title = 'Weight'),
                     yaxis = list(title = 'HP'),
                    zaxis = list(title = 'mpg')))