library(ggplot2)
library(dplyr)
trade_data <- data.frame(
# FY ending year (FY2015 = Apr 2014–Mar 2015). Source: DGCI&S, MoCI, GoI.
year = 2015:2024,
exports = c(310.3, 262.3, 275.8, 303.5, 330.1, 314.3, 291.8, 422.0, 453.0, 437.1),
imports = c(448.0, 381.0, 384.4, 465.6, 514.0, 467.2, 394.4, 612.0, 714.2, 677.2)
)
trade_long <- tidyr::pivot_longer(trade_data, cols=c(exports, imports), names_to="type", values_to="value")
trade_long$type <- factor(trade_long$type, levels=c("exports","imports"),
labels=c("Exports","Imports"))
ggplot(trade_long, aes(x=year, y=value, color=type, group=type)) +
geom_line(linewidth=1.5) +
geom_point(size=3) +
geom_ribbon(data=trade_data, aes(x=year, ymin=exports, ymax=imports),
inherit.aes=FALSE, fill="grey80", alpha=0.5) +
scale_color_manual(values=c("Exports"="#012169", "Imports"="#B9975B")) +
scale_x_continuous(breaks=2015:2024) +
scale_y_continuous(labels=scales::dollar_format(suffix="B")) +
labs(title="India's Merchandise Trade Trend (FY2015–FY2024)",
subtitle="Trade deficit peaked at $261B in FY2023; FY2021 dip reflects COVID. Source: DGCI&S, MoCI, GoI",
x=NULL, y="USD Billion", color=NULL) +
theme_minimal(base_size=11) +
theme(legend.position="bottom", axis.text.x=element_text(angle=45, hjust=1))