Alluvials

Load the alluvial package

#library(alluvial)

library(ggalluvial)
## Warning: package 'ggalluvial' was built under R version 4.1.2
## Loading required package: ggplot2
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(reshape2)

Ss <- read.csv("SsTable.csv")

SsLong <- melt(Ss, id.vars=c("Course","Value"),
               measure.vars=c("X2","X4","X6","X8","X10","X12","X14","X16","X18","X20","X22","X24"),
               variable.name = "Terms")
Ss2 <- SsLong %>%
   filter(!is.na(value) , Value>1000)

Alluvial of pass rates based on first semester enrollments

ggalluv <- ggplot(Ss2,
             aes(x = Terms, y = value, alluvium = Course)) +
  theme_bw() +
  geom_alluvium(aes(fill = Course, color = Course),
                width = .1, alpha = .5, decreasing = FALSE, curve_type = "sigmoid")
  ggalluv

Ss2 <- SsLong %>%
   filter(!is.na(value) , Value>2000)

ggalluv <- ggplot(Ss2,
             aes(x = Terms, y = value, alluvium = Course)) +
  theme_bw() +
  geom_alluvium(aes(fill = Course, color = Course),
                width = .1, alpha = .5, decreasing = FALSE, curve_type = "linear")+
    scale_fill_brewer(palette = "Spectral") +
    scale_x_discrete()
  ggalluv