Skip to content

Instantly share code, notes, and snippets.

@geotheory
Last active August 29, 2015 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geotheory/f284caa4584fa50764cf to your computer and use it in GitHub Desktop.
Save geotheory/f284caa4584fa50764cf to your computer and use it in GitHub Desktop.
Alluvial_ts example
require(alluvial)
require(reshape2)
d <- read.table(text="Class,1991,2003,2005,2009,2011,2013
1,818,604,601,570,563,556
2,183,147,145,143,142,150
3,40,55,55,55,55,50
4,48,70,81,76,85,99
5,126,140,142,148,155,153
6,396,566,568,566,525,508
7,158,189,153,98,118,123
8,244,206,238,296,269,247
9,83,91,85,90,86,92
10,76,88,88,89,89,91
11,28,30,30,30,30,30
12,0,14,14,39,83,101", sep=',', header=T, stringsAs=F)
d = melt(d, id.vars='Class')
names(d) <- c('class','year','value')
d$year = as.numeric(substr(as.character(d$year),2,5))
cols <- sample(hsv(h = sample(1:12/12), s = sample(5:16)/18, v = sample(5:16)/18))
alluvial_ts(d, wave=.6, col=cols, leg.mode=F, leg.y = .6, leg.col='#00000077', leg.lwd=20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment