Skip to content

Instantly share code, notes, and snippets.

@menugget
menugget / plot.stacked.2.R
Last active February 25, 2019 18:38
Stacked plot
#plot.stacked makes a stacked plot where each y series is plotted on top
#of the each other using filled polygons
#
#Arguments include:
#'x' - a vector of values
#'y' - a matrix of data series (columns) corresponding to x
#'order.method' = c("as.is", "max", "first")
# "as.is" - plot in order of y column
# "max" - plot in order of when each y series reaches maximum value
# "first" - plot in order of when each y series first value > 0
@menugget
menugget / ex_plot.stacked_plot.stream.R
Created December 8, 2013 22:19
Example of plot.stacked and plot.stream functions
library(devtools)
source_url('https://gist.github.com/menugget/7689145/raw/dac746aa322ca4160a5fe66c70fec16ebe26faf9/image.scale.2.r')
source_url('https://gist.github.com/menugget/7864454/raw/f698da873766347d837865eecfa726cdf52a6c40/plot.stream.4.R')
source_url('https://gist.github.com/menugget/7864471/raw/8127dfaae183233d203580bc247a73a564d5feab/plot.stacked.2.R')
set.seed(1)
m <- 500
n <- 30
makeGlobcolourField <- function(
dataPath=getwd(),
yearRan=c(1997,2013),
lonRan=c(-83,-79),
latRan=c(-16,-4),
greps=c(".nc", "GSM", "MO")
){
#Import data
grd <- list()