Module # 7 assignment

Issaiah Jennings 

Module # 7 assignment

In this post, I tested visual distribution analysis using the mtcars dataset in R, following the recommendation from our textbook to use a grid layout for comparing variables. The mtcars dataset is built into R, so you can easily access it by typing data(mtcars).

I created scatter plots to compare variables like miles per gallon (mpg), weight (wt), and horsepower (hp). By organizing these plots into a grid, I could quickly see the relationships between the variables. Here's the R code I used to generate the plots:


# Load the necessary libraries

install.packages("gridExtra")


library(ggplot2)

library(gridExtra)


# Load the mtcars dataset

data(mtcars)


# Create scatter plots

plot1 <- ggplot(mtcars, aes(x=mpg, y=wt)) + geom_point() + ggtitle("MPG vs Weight")

plot2 <- ggplot(mtcars, aes(x=mpg, y=hp)) + geom_point() + ggtitle("MPG vs Horsepower")

plot3 <- ggplot(mtcars, aes(x=wt, y=hp)) + geom_point() + ggtitle("Weight vs Horsepower")


# Combine plots into a grid

grid.arrange(plot1, plot2, plot3, ncol=2)





The grid layout makes it easier to compare the variables side by side, which aligns with Few’s recommendations for useful visual analytics. I found it helpful for quickly spotting patterns and relationships in the data. Overall, this approach definitely enhances data analysis by improving clarity and comparison.







Comments

Popular posts from this blog

Final project in this class Spring 2025

Module # 5 assignment

Assignment # 4: Time Series Visualization Using Tableau Public