2024-02-15

Introduction

The figure was created using data from the 1974 Motor Trend US magazine, that comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models). Here the graph displays the relationship between miles per gallon, weight (1000lbs), number of cylinders and gross horsepower of each car included in the dataset.

Code for figure

library(plotly)
data(mtcars)
fig <- plot_ly(data=mtcars, x = mtcars$wt, y = mtcars$mpg, 
               mode="markers", 
               color = as.factor(mtcars$cyl), size=mtcars$hp)

Figure