You are on page 1of 10

NAME: R B SHARAN

REG NO: 20MID0209


COURSE: CSI 3005 – Advanced Data Visualization Techniques

ASSESSMENT – 7

Vector Data Visualization

Problem Question 1:
Iterate your existing dataset with two keys and perform multidimensional
data visualization Perform the following Visualization.

a) Heat maps:
Dataset Preparation:
Code:
df<-read.csv('Sales.csv')
df
library(ggplot2)
ggplot(df, aes(x = Region, y = Product, fill = Sales)) +
geom_tile() +
scale_fill_gradient(low = "white", high = "red") +
labs(title = "Total Sales by Product and Region", x = "Region", y = "Product",
fill = "Sales")
Heat map Visualization:

Inference:

From this, heatmap that shows the total sales by product and
region, with the highest sales values colored in red and
lowest sales values are in white colored.
b) Cluster Map/ chart:
Dataset Preparation:

Code:
library(pheatmap)

# Create matrix of sales by product and region


sales_matrix <- reshape2::dcast(df, Product ~ Region, value.var = "Sales")

# Remove the Product column from the matrix


sales_matrix <- sales_matrix[, -1]
# Scale the data by row (product)
scaled_data <- t(scale(t(sales_matrix)))

# Create cluster map


pheatmap(scaled_data,
clustering_distance_rows = "euclidean",
clustering_distance_cols = "euclidean",
clustering_method = "complete",
fontsize_row = 10,
fontsize_col = 10,
color = colorRampPalette(c("blue", "white", "red"))(100),
main = "Cluster Map of Sales by Product and Region")
Cluster map visualization:

Inference:
From this, cluster map showing the relationship between the products and
regions based on their sales. The rows (products) and columns (regions) are
clustered based on their similarity in sales, and the colors represent the
relative sales values. The resulting plot will show the dendrograms for the
clustering of rows and columns, as well as the heatmap itself.
Problem Question 2:
Use your existing dataset and perform the table vs matrix
visualization

Table Visualization:
Dataset Preparation:

Data Visualization: Using Power BI to visualize the Table Visualization


and Matrix Visualization.
Output for Table Visualization:

Matrix Visualization:

So if we expand the Product details we can able to see the how much products
are bought in an year.
Output for Matrix Visualization:
Inference for Table vs Matrix visualization
Table visualizations are useful for comparing and analyzing individual
data points or values, matrix visualizations are more effective in
identifying relationships and patterns between different variables
and dimensions of the data.

You might also like