3 Visualization
# Load necessary libraries
library(ggplot2)
# Load the dataset
data <- read.csv("~/Documents/statistics(1)/laptop_prices.csv")
# Classify GPU as Integrated or Discrete
data$GPU_type <- ifelse(grepl("HD Graphics|Iris", data$GPU_model), "Integrated", "Discrete")
# Create the bar chart
ggplot(data, aes(x = GPU_model, y = Price_euros, fill = GPU_type)) +
geom_bar(stat = "summary", fun = "mean", position = position_dodge(width = 0.9)) +
labs(title = "Average Laptop Price by GPU Model",
x = "GPU Model",
y = "Average Price (Euros)") +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 60, hjust = 1, size = 5), # Adjust angle and size
plot.title = element_text(hjust = 0.5, size = 14, vjust = 2), # Center and adjust title
plot.margin = margin(t = 20, r = 10, b = 10, l = 10) # Increase top margin for title
) +
scale_fill_manual(values = c("Integrated" = "lightblue", "Discrete" = "lightgreen")) +
annotate("text", x = 5, y = max(data$Price_euros, na.rm = TRUE) * 0.9,
label = "Lack of detail affects comparison", color = "red", size = 3, vjust = -0.5) +
annotate("text", x = 8, y = max(data$Price_euros, na.rm = TRUE) * 0.8,
label = "Is 'HD Graphics' too generic?", color = "red", size = 3, vjust = -0.5) +
coord_cartesian(clip = "off")

#There is little bit confusion for the models of GPU while aligning.
They are overlapped.
#The models are FirePro, For GeForce, Graphic, HD Graphics, Iris
Graphics, Quadro, Radeon, UHD Graphics. #FirePro - FirePro W4190M,
FirePro W6150M, FirePro W5130M #For GeForce - GeForce 150MX, GeForce
920, GeForce 920M, GeForce 930M, GeForce 930MX, GeForce 940M, GeForce
960M, GeForce GT 940MX, GeForce GTX 1050, GeForce GTX 1050 Ti, GeForce
GTX 1050M, GeForce GTX 1060, GeForce GTX 1070, GeForce GTX 1070M,
GeForce GTX 1080, GeForce GTX 930MX, GeForce GTX 940M, GeForce GTX
940MX, GeForce GTX 950M, GeForce GTX 960M, GeForce GTX 965M, GeForce GTX
970M, GeForce GTX 980, GeForce GTX 980M, GeForce GTX1050 Ti, GeForce
GTX1060, GeForce GTX1080, GeForce MX130. #Graphic 620, GTX 980 SLI #For
HD Graphics - HD Graphics, HD Graphics 400, HD Graphics 405, HD Graphics
500, HD Graphics 505, HD Graphics 510, HD Graphics 515, HD Graphics 520,
HD Graphics 530, HD Graphics 5300, HD Graphics 540, HD Graphics 6000, HD
Graphics 615, HD Graphics 620, HD Graphics 630. #For Iris Graphics -
Iris Graphics 540, Iris Graphics 550, Iris Plus Graphics 640, Iris
Graphics 650, Iris Pro Graphics. #Mali T860 MP4 #For Quadro - Quadro
3000M, Quadro M1000M, Quadro M1200, Quadro M2000M, Quadro M2200, Quadro
M2200M, Quadro M3000M, Quadro M500M, Quadro M520M, Quadro M620, Quadro
M620M. #For Radeon and its models
#Here light blue is for integrated GPUs and light green for discrete
GPUs. #Integrated and discrete GPUs are not explicitly labeled in
original data #Annotations point out where lack of specificity in the
GPU model(HD graphics) that lead to confusion.
#Here we highlight the inconsistency in the GPU_model column. Main
issue is lack of differentiation between integrated and discrete GPUs
and the inconsistent detail in GPU model names.
#Risks - Misleading price comparisons like without knowing whether a
GPU is integrated or discrete, users could misinterpret the data,
assuming that two laptops with “HD Graphics” are comparable in
performance, which is not always true.
#Faulty Performance Assumptions - ntegrated GPUs like “HD Graphics”
can vary in performance across generations, leading to misleading
conclusions about laptop capabilities.
#Solution - To reduce these risks, the dataset could be improved by
categorizing GPUs more explicitly (e.g., separating integrated
vs. discrete and specifying GPU generation).
#Documentation: Clearer definitions of GPU models and their
performance implications should be provided in the dataset
documentation.