# SCI Figure Hub — Publication Bar Chart with Error Bars & Significance Letters (CC0-1.0) library(ggplot2) pal <- c("#E64B35", "#4DBBD5", "#00A087", "#3C5488", "#F39B7F", "#8491B4") df <- data.frame( group = factor(c("Ctrl", "Cat-A", "Cat-B", "Cat-C", "Cat-D", "Cat-E"), levels = c("Ctrl", "Cat-A", "Cat-B", "Cat-C", "Cat-D", "Cat-E")), mean = c(42.0, 68.4, 89.2, 76.1, 58.3, 94.0), sem = c(4.1, 5.2, 3.8, 4.9, 3.6, 3.2), sig = c("c", "b", "a", "ab", "bc", "a") ) p <- ggplot(df, aes(x = group, y = mean, fill = group)) + geom_col(width = 0.58, colour = "#1E293B", linewidth = 0.3) + geom_errorbar(aes(ymin = mean - sem, ymax = mean + sem), width = 0.18, linewidth = 0.4) + geom_text(aes(y = mean + sem + 3.5, label = sig), size = 2.8, fontface = "bold") + scale_fill_manual(values = pal) + scale_y_continuous(limits = c(0, 112), expand = expansion(mult = c(0, 0.02))) + labs(x = NULL, y = "Relative Activity (%)") + theme_classic(base_size = 8, base_family = "sans") + theme(legend.position = "none", axis.text = element_text(colour = "#121C26")) ggsave("bar_significance.pdf", p, width = 89, height = 62, units = "mm")