Posts

LIS 4317 Final Project – Diamonds Analysis

Image
Diamonds constitute one of the most extensively examined datasets in R due to their numerous quality attributes that affect valuation. For this undertaking, I employed the diamonds dataset from the ggplot2 package to investigate the relationship between carat (weight), cut quality, and clarity in relation to diamond prices. This dataset provided an opportunity to apply and demonstrate proficiency in distribution analysis, comparative evaluation, and multivariate visualization methods acquired during LIS 4317. Overview of the Dataset The diamonds dataset comprises 53,940 observations and ten variables, thereby satisfying the project's criterion of a minimum of fifty rows and five to twenty variables. Key variables encompass: Cost – Price of diamond in United States dollars Carat – the mass of the diamond Reduce — reduction in quality levels (Fair, Good, Very Good, Premium, Ideal) Color – the process of color grading Clarity – Evaluation of transparency and lucidity I ...

Module 12. Assignment

Image
For this assignment, I constructed an undirected social network graph utilizing Python, networkx, pandas, and plotnine. The procedure for generating the random graph and transforming the node and edge positions into DataFrames was highly effective. Once all components were configured, Plotnine facilitated the creation of a clear and well-structured visualization. The primary difficulties I encountered pertained to the visualization and preservation of the graph. Initially, the plot failed to display in a window due to infrastructure issues, and I inadvertently attempted to execute Python code within RStudio, resulting in errors. I addressed this issue by transitioning to Python directly, modifying the graphical backend, and exporting the image as a PNG rather than attempting to display it. Subsequently, the graph was exported effectively without any issues. Overall, I would employ this method again. It provides extensive control over the network's configuration and facilita...

Module 11. Assignment

Image
I read Dr. Piwek's talk on Edward Tufte and Charles Minard for this module, and then I made the dot-dash plot again using basic R. I noticed that the basic R version was the only one that could make the visual displayed in my attached figure after I installed and loaded all the visualization packages. I used the code that came with the module to make a graph of per-capita budget spending. It showed a range of years from 1967 to 1977 and the y values that went with them. The plot(), axis(), and abline() methods produced the linked points and dashed reference lines at 5 and 6. The text() function added notes for the 5 percent line and an explanatory caption. The output shows Tufte's minimalist design principle: it is clean, focused on data, and simple to understand. pkgs <- c("CarletonStats","devtools","epanetReader","fmsb","ggplot2","ggthemes","latticeExtra","MASS","PerformanceAnalytics...

Module 10. Assignment

Image
  I learned how to use the ggplot2 package in R to show time-series data in this lesson. It taught me how good visual design can help turn raw data into stories that make sense after reading Visualize This by Nathan Yau and Selva Prabhakaran's Complete ggplot2 Tutorial The built-in economics information shows changes in U.S. unemployment from 1967 to 2015, so I used it to make my own images for practice. I was interested in how mapping data could help people understand and make sense of long-term business trends. The code i have use in R library(ggplot2) library(gridExtra) data("economics") # Extract year for color mapping economics$year <- as.integer(format(economics$date, "%Y")) # 1. Line graphs: unemployment rate and median duration plot1 <- qplot(date, unemploy / pop, data = economics, geom = "line") +   labs(title = "U.S. Unemployment Rate Over Time",        x = "Date", y = "Unemployed / Population") plot2 ...

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", ...