library(ggplot2) library(plotly) data <- read.csv("annual-ftes-allocated-to-atip-directorate-by-classification-and-institution-2019-2023.csv", header = TRUE, sep = ",") data$institution <- factor(data$institution, levels=c('ISC', 'CIRNAC')) data$classification <- factor(data$classification, levels=c('Consultant', 'Student', 'Regional', 'Part-time', 'Full-time')) // If we want white separation between Years p <- ggplot(data) + geom_bar(aes(x = institution, y = ftes, fill = classification), position = "stack", stat = "identity") + facet_grid(~ year) + scale_fill_manual(values=c("#238b45", "#eff3ff", "#bdd7e7", "#6baed6", "#2171b5"))+ labs(fill = "Classification", x = "Institution", y = "FTEs") ggplotly(p) // If we want ***no*** white separation between Years and the label = "Year" at bottom: p <-ggplot(data) + geom_bar(aes(x = institution, y = ftes, fill = classification), position = "stack", stat = "identity") + facet_grid(~ year, switch = "x") + scale_fill_manual(values=c("#238b45", "#eff3ff", "#bdd7e7", "#6baed6", "#2171b5"))+ theme(strip.placement = "outside", strip.background = element_rect(fill = NA, color = "white"), panel.spacing = unit(-.01,"cm"))