# install.packages("ggplot2") once
library(readr); library(dplyr); library(ggplot2)
sales <- read_csv("sales.csv") |> mutate(amount = qty * rate)
by_region <- sales |> group_by(region) |> summarise(sales = sum(amount))
ggplot(by_region, aes(x = reorder(region, sales), y = sales / 1e5)) +
  geom_col(fill = "#c2410c") + coord_flip() +
  labs(title = "Sales by region", x = NULL, y = "Rs lakh") + theme_minimal()
ggsave("sales_by_region.png", width = 6, height = 4)
