Spotting Differences in R: Comparing Fuel Efficiency by Cylinder Count

 

For this assignment, I used RStudio and the built-in mtcars dataset to explore differences in average miles per gallon (MPG) across cars with different numbers of cylinders. Using ggplot2, I created a simple bar chart that displays the mean MPG for 4-, 6-, and 8-cylinder cars.

The chart clearly shows that 4-cylinder cars achieve the highest average fuel efficiency, followed by 6-cylinder, and then 8-cylinder vehicles with the lowest MPG. This visualization directly supports a spotting differences task, it makes the contrasts between groups immediately visible through bar height comparisons along a shared baseline.

From a design perspective, I applied a minimal theme and used a clear title and axis labels to keep attention on the comparison itself. This aligns with Stephen Few’s principle of simplifying visuals so that viewers can detect differences quickly and accurately. Likewise, Yau emphasizes using straightforward encodings, like length along a common scale, to make quantitative distinctions intuitive.

One challenge I faced was deciding how to summarize the data: individual points provide more detail, but the mean bars offered a cleaner overview of group trends. If I expanded this chart, I might add error bars or a boxplot version to show variability within each cylinder group, making the visual even more informative.

 

Comments

Popular posts from this blog

Student Loan Program Trends in the United States (2007–2025)

My Geographic Map of Florida COVID-19 Cases by ZIP Code