This is an interactive plot created by plotly package. It describes the relationship between cars’ weights and their Miles per gallon based on mtcars data. Besides, the color of points represents the car’s forward gears number.
2025-04-13
This is an interactive plot created by plotly package. It describes the relationship between cars’ weights and their Miles per gallon based on mtcars data. Besides, the color of points represents the car’s forward gears number.
library(plotly)
mt=mtcars
mt$gear=as.factor(mt$gear)
plot_ly(mt,x=~wt,y=~mpg,mode="markers",
color=~gear)