LA

Author

Saraswathi and Sandhya naik

Load libraries

library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.5.3
library(treemapify)
Warning: package 'treemapify' was built under R version 4.5.3

Create dataset (Q1 2025 approximate from StatCounter)

market_share <- data.frame(
  Brand = c("Apple", "Samsung", "Xiaomi", "Oppo", "Vivo", "Others"),
  Share = c(27.9, 20.0, 10.3, 6.1, 5.9, 29.8)
)

Create treemap

ggplot(market_share, aes(area = Share, fill = Brand, label = paste(Brand, "\n", Share, "%"))) +
  geom_treemap() +
  geom_treemap_text(colour = "white", place = "centre", grow = TRUE) +
  labs(
    title = "Smartphone Market Share Treemap (Q1 2025)",
    subtitle = "Source: StatCounter (approximate data)",
    fill = "Brand"
  ) +
  theme_minimal()