2024-07-05

First Step

  • loading the plotly package
  • loading the data set
  • checking for the names of the variables
library(plotly)

library(datasets)
data("mtcars")

colnames(mtcars)
##  [1] "mpg"  "cyl"  "disp" "hp"   "drat" "wt"   "qsec" "vs"   "am"   "gear"
## [11] "carb"

Second Step

Plotting the mpg fuel efficiency based on:

  • weight
  • displacement of engine
  • number of cylinders (changed to be factor for the color)