This project aims to demonstrate the skills and techniques learned throughout the data visualization specialization by creating a series of compelling and informative graphics. The dataset used in this project consists of categorical values and their corresponding numerical values. The dataset is simple but provides a good basis for showcasing various types of visualizations including bar charts, line plots, box plots, heatmaps, interactive plots, animated plots, scatter plot, and pie chart.
# Load the dataset
data <- read.csv("sample_data.csv")
head(data)
## Category Values
## 1 A 23
## 2 B 45
## 3 C 12
## 4 D 67
## 5 E 34
# Bar chart
library(ggplot2)
ggplot(data, aes(x=Category, y=Values)) +
geom_bar(stat="identity") +
ggtitle("Distribution of Categories") +
xlab("Category") +
ylab("Values")
# Line plot
ggplot(data, aes(x=Category, y=Values, group=1)) +
geom_line() +
geom_point() +
ggtitle("Values by Category") +
xlab("Category") +
ylab("Values")
# Box plot
ggplot(data, aes(x=Category, y=Values)) +
geom_boxplot() +
ggtitle("Box Plot of Values by Category") +
xlab("Category") +
ylab("Values")
# Heatmap
library(reshape2)
data_melt <- melt(data)
## Using Category as id variables
ggplot(data_melt, aes(x=variable, y=Category, fill=value)) +
geom_tile() +
ggtitle("Heatmap of Values") +
xlab("Variable") +
ylab("Category")
##
## 載入套件:'plotly'
## 下列物件被遮斷自 'package:ggplot2':
##
## last_plot
## 下列物件被遮斷自 'package:stats':
##
## filter
## 下列物件被遮斷自 'package:graphics':
##
## layout
# Conclusion Overall, these visualizations offer a clear and detailed
view of the dataset, allowing for a deeper understanding of the
categorical values and their distributions. The use of different types
of plots, including static, interactive, and animated, ensures a
well-rounded analysis, catering to various analytical needs and
preferences.