In this sample, heavier cars tend to travel fewer miles per gallon. Explore the relationship yourself, one car at a time.
Created November 16, 2026 · Sarthak · R Markdown + Plotly
Each dot is one car. Hover for its details; click a cylinder group in the legend to hide or show it. Drag to zoom and double-click to reset.
Compare the spread of fuel economy within each cylinder group. Every dot is an observed car; boxes summarize the distribution.
In these 32 cars, weight and fuel economy have a strong negative association. Average fuel economy is 26.7 mpg for 4-cylinder cars, 19.7 mpg for 6-cylinder cars, and 15.1 mpg for 8-cylinder cars.
Heavier cars generally have lower MPG, with variation between individual cars.
This observational sample does not prove that weight alone causes the MPG difference, and it does not describe today’s vehicle market.
The mtcars dataset ships with R. It contains fuel
consumption and 10 aspects of automobile design and performance for 32
automobiles (1973–74 models), extracted from the 1974 US magazine
Motor Trend.
We use weight (wt, in 1,000 pounds), fuel economy
(mpg, miles per US gallon), and cylinder count
(cyl). The correlation is Pearson’s correlation, calculated
from all 32 rows. No observations were removed.
Both charts are generated in R with plotly::plot_ly()
and embedded by R Markdown. This page is self-contained, so the charts
do not need an external data service.
Document created November 16, 2026. Data describe historical cars; the creation date refers to this presentation.