install.packages("plotly")
library(plotly)
library(plotly)
## Warning: package 'plotly' was built under R version 3.4.2
## Warning: package 'ggplot2' was built under R version 3.4.1
plot_ly(mtcars, x = ~wt, y = ~mpg, type = "scatter", color = ~factor(cyl))