Posts

Showing posts from October, 2025

Module 9. Assignment

Image
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 to...

Module 8. Assignment

Image
    For this week's lab, I used R's built-in mtcars dataset to look into how weight and horsepower of a car affect its gas mileage (MPG). I did both association and regression studies, and both showed strong negative relationships: cars that are larger and more powerful get worse gas mileage. I used ggplot2 to make a scatter plot with a regression line and a segmented comparison that puts both factors next to each other. With Facets, it was easy to compare two relationships without all the extra stuff. Few told me to use bland colors, little ink, and clear labels, which made it easy to read and understand the falling trends. R code  mtcars # Use cor() to compute correlation matrices. cor_matrix <- cor(mtcars[, c("mpg", "wt", "hp", "disp")]) round(cor_matrix, 2) m_mpg_wt <- lm(mpg ~ wt, data = mtcars) summary(m_mpg_wt) library(ggplot2) library(tidyr) ggplot(mtcars, aes(x = wt, y = mpg)) +   geom_point(color = "steelblue"...

Visualizing Distributions in R

Image
  The goal for this week was to make a distribution visualization in R and think about how well it worked. I used the usual mtcars dataset that comes with R for this purpose. This multidimensional figure makes it evident that there is a negative correlation: as the weight of the automobile goes up, the MPG goes down. The grid also reveals that automobiles with 4, 6, and 8 cylinders are grouped together. This design follows the advice of Stephen Few and Nathan Yau, who say that tiny multiples with aligned axes are better for straightforward comparison than a single, overloaded chart. I completely agree with Few's criticism that conventional ways of visualizing data, including layering graphs, might hide the underlying structure of a dataset. This way of breaking the facts into a grid makes the tale more clearer and more honest. R-code # Load the ggplot2 library library(ggplot2) # Create a density plot ggplot(mtcars, aes(x = mpg)) + geom_density(fill = "skyblue", ...

Module 6. Assignment

Image
  I made a histogram with a normal curve on top of it using the built-in mtcars dataset for this project to run a deviation analysis. The histogram shows how the Miles Per Gallon (MPG) values for 32 cars are spread out. The blue normal curve shows the expected "bell-shaped" pattern that is typical of a normal distribution. This picture showed that the actual data didn't differ much from the expected curve. Most of the cars were between 15 and 20 MPG, while a few high-efficiency models made a little right skew. This image doesn't compare categories, but it does show how different data points are from the mean and how they differ from the mean. The design follows the ideas put out by Few (Chapter 9) and Yau (Chapter 7) by making sure that it is simple, has clear labels, and has a limited color palette to provide significance. The main issue I had was getting the normal curve to fit the histogram's frequency correctly. However, after I fixed it, the present...

Module 5. Part-to-Whole and Ranking Analysis

Image
  I used a dataset that is split into groups (T, S, R, Q, and Other) for this lesson so I could see how each part fits in with the whole. It was easy for me to choose because the numbers make it clear how the different groups are different. There are three different stories in the donut charts: The total numbers are shown in X.1. "Other" is much bigger than the others. In terms of rank, the average position shows that "Other" is way ahead of the others, with the others being close behind. Time shows how long each group takes, and we can see that one group takes most of the time. Visuals that show the relationship between parts and wholes are a quick way to show who has the biggest share. They look good on a blog and are easy to read. But it's harder to see the little changes between the slices, so a bar chart would be better some of the time. In general, I like how this chart makes the imbalance clear while also letting me know the boundaries when I...