Module 9. Assignment

Horsepower, Cylinders, and Gas Sapper Cars

The mtcars collection is built into R, and I used it for this task. This dataset was chosen because it is easy to understand and use. This makes it great for learning multivariate graphics without getting lost in complicated data. "How do horsepower, cylinders, and transmission type all work together to affect a car's gas mileage?"

What the visualization taught me
My scatterplot shows four different factors, and the trends were clear right away:

Most importantly, there is a strong, negative link between horsepower and gas mileage. The miles per gallon (y-axis) goes down as the horsepower (x-axis) goes up.

Cylinder Groups: The cars can be easily divided into three groups based on their color schemes. The red 4-cylinder cars have low horsepower and high mpg, while the blue 8-cylinder cars have high horsepower and low mpg. The cars with six cylinders are in the middle.


Transmission Matters: The way the shapes are put together shows that, for any given group of cars, manual cars (triangles) get slightly better gas economy than automatic cars (circles) with the same amount of horsepower.

Rules for Design
Three important design rules helped me make this chart work:

The most important idea here is contrast. For strong contrast, I used two different visual channels: color (for the cylinders) and shape (for the transmission). This makes it simple for the brain to tell these two things apart. A 4-cylinder manual car (red triangle) can be told apart from an 8-cylinder automatic car (blue circle) right away.

Transmission Matters:
With this natural grouping, we can see how the clusters (the cylinder groups) form naturally based on the data.

Alignment: A simple grid-based alignment is used for the whole image. All 32 cars are lined up on the same x-axis (Horsepower) and y-axis (MPG). This creates a standard that makes comparisons fair and easy to understand.

This multivariate rendering worked really well. We confirmed a known relationship (hp vs. mpg) and also found the effects of two other factors (cylinders and transmission) on the relationship, showing how they all work together.





R- code 

# Load the ggplot2 library
library(ggplot2)

# Create the plot
ggplot(mtcars, aes(x = hp, y = mpg, color = as.factor(cyl), shape = as.factor(am))) +
  geom_point(size = 4) + # Made points larger to see shape clearly
  labs(title = "Fuel Efficiency vs. Horsepower",
       x = "Horsepower (hp)",
       y = "Miles Per Gallon (mpg)",
       color = "Cylinders",
       shape = "Transmission") +
  theme_minimal() +
  scale_shape_manual(labels = c("Automatic", "Manual"), values = c(16, 17)) 


Comments

Popular posts from this blog

LIS 4317 Final Project – Diamonds Analysis

Visualizing Distributions in R

Module 5. Part-to-Whole and Ranking Analysis