Use Plotly to visualise mtcar dataset

library(plotly)
## Loading required package: ggplot2
## 
## 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
data(mtcars)
df <- data.frame(mtcars$mpg, mtcars$cyl, mtcars$wt)
x <- c("mpg", "cyl", "wt")
colnames(df) <- x
summary(df)
##       mpg             cyl              wt       
##  Min.   :10.40   Min.   :4.000   Min.   :1.513  
##  1st Qu.:15.43   1st Qu.:4.000   1st Qu.:2.581  
##  Median :19.20   Median :6.000   Median :3.325  
##  Mean   :20.09   Mean   :6.188   Mean   :3.217  
##  3rd Qu.:22.80   3rd Qu.:8.000   3rd Qu.:3.610  
##  Max.   :33.90   Max.   :8.000   Max.   :5.424

Create an interactive plot

plot_ly(df, x = ~ wt, y = ~ mpg, color = ~ cyl, mode="markers")