library(ggplot2) library(ggalluvial) dat = read.csv("Sankey diagram.csv", head=T) str(dat) #####from small to large according to urban area dat$CityID <- factor(dat$CityID, levels = c("Nujiang", "Chuxiong", "Lincang", "Zhaotong" , "Diqing","Lijiang" , "Baoshan" , "Honghe", "Wenshan", "Dehong" , "Puer", "Dali" , "Yuxi" , "Xishuangbanna", "Qujing", "Kunming")) ###"#a2ded0","#29f1c3","#4ecdc4","#86e2d5", "#36d7b7" , "#7dfee3","#fabe58","#eb9532" col<-c("#a2ded0","#36d7b7","#d64541", "#4ecdc4") ggplot(as.data.frame(dat), aes(y = Richness, fill=Dipersal.mode, axis1 = Life.form, axis2 = Dipersal.mode, axis3 = CityID )) + geom_flow(width = 0.3, curve_type = "sine", alpha = 0.5, color = 'white' )+ geom_alluvium(aes(fill = Dipersal.mode), width = 1/12) + geom_stratum(width = 2/12, #fill = , #color = "grey" ) + theme_void()+ theme(legend.position = 'none')+ geom_label(stat = "stratum", aes(label = after_stat(stratum))) + scale_x_discrete(limits = c("Life.form", "Dipersal.mode"), expand = c(.05, .05)) + scale_fill_manual(values = c("#8B4C39","#66CC33","#66CCCC","#FFCC66"))