该图看起来相当不错,所以我尝试重现它。事实证明它比我想象的要复杂一些。
df=read.table("test_data.txt",header=T,sep=",")
#turn O into NA until >0 then keep values
df2=data.frame(Year=df$Year,sapply(df[,!colnames(df)=="Year"],function(x) ifelse(cumsum(x)==0,NA,x)))
#turn dataframe to a long format
library(reshape)
molten=melt(df2,id.vars = "Year")
#Create a new value to measure the increase over time: I used a log scale to avoid a few classes overshadowing the others.
#The "increase" is measured as the cumsum, ave() is used to get cumsum to work with NA's and tapply to group on "variable"
molten$inc=log(Reduce(c,tapply(molten$value,molten$variable,function(x) ave(x,is.na(x),FUN=cumsum)))+1)
#reordering of variable according to max increase
#this dataframe is sorted in descending order according to the maximum increase"
library(dplyr)
df_order=molten%>%group_by(variable)%>%summarise(max_inc=max(na.omit(inc)))%>%arrange(desc(max_inc))
#this allows to change the levels of variable so that variable is ranked in the plot according to the highest value of "increase"
molten$variable<-factor(molten$variable,levels=df_order$variable)
#plot
ggplot(molten)+
theme_void()+ #removes axes, background, etc...
geom_line(aes(x=variable,y=Year,colour=inc),size=2)+
theme(axis.text.y = element_text())+
scale_color_gradientn(colours=c("red","green","blue"),na.value = "white")# set the colour gradient
给出:

不如论文中的那么好,但这是一个开始。