# SCI Figure Hub — Forest Plot for Hazard Ratios (CC0-1.0) pal <- c("#3C5488", "#E64B35") library(ggplot2) df <- data.frame( study = factor(c("Subgroup A", "Subgroup B", "Subgroup C", "Subgroup D", "Subgroup E", "Overall"), levels = rev(c("Subgroup A", "Subgroup B", "Subgroup C", "Subgroup D", "Subgroup E", "Overall"))), hr = c(0.62, 0.74, 0.55, 0.89, 0.68, 0.69), lo = c(0.44, 0.56, 0.36, 0.67, 0.49, 0.58), hi = c(0.87, 0.98, 0.84, 1.18, 0.94, 0.82), is_overall = c(FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) ) p <- ggplot(df, aes(x = hr, y = study, colour = is_overall)) + geom_vline(xintercept = 1, linetype = "dashed", linewidth = 0.4, colour = "#64748B") + geom_errorbarh(aes(xmin = lo, xmax = hi), height = 0.18, linewidth = 0.55) + geom_point(aes(shape = is_overall), size = 2.6) + scale_x_log10(breaks = c(0.3, 0.5, 1.0, 1.5)) + scale_colour_manual(values = c("FALSE" = pal[1], "TRUE" = pal[2])) + scale_shape_manual(values = c("FALSE" = 15, "TRUE" = 18)) + labs(x = "Hazard Ratio (95% CI, log scale)", y = NULL) + theme_classic(base_size = 8) + theme(legend.position = "none") ggsave("forest_plot.pdf", p, width = 105, height = 65, units = "mm")