Professional Documents
Culture Documents
ASSESSMENT – 9
Question:
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)
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.