plot_projbars: Barplots of projected changes

Description Usage Arguments Value Examples

View source: R/plot_projbars.R

Description

Function to plot bars of projected changes

Usage

1
2
3
4
5
6
plot_projbars(meanchange, allchange = NULL, ylim = NULL, nmods = NULL,
  nsim = NULL, add.legend = TRUE, yside = 4, add.rect = TRUE,
  ylab = "", las = 2, xlas = 2, title = "", scenarios = NULL,
  add.nmod = FALSE, seas = NULL, lwd = 10, lwd2 = 2,
  cex = par("cex.axis"), legend.pos = "topright", add = FALSE,
  scols = scencols, scols2 = scencols2, yaxt = "s", distance = 0.5)

Arguments

meanchange

list of projected n-year mean change (seasons // scenario)

allchange

list of projected annual changes (seasons // scenario)

ylim

vertical extent of plot

nmods,nsim

number of models and simulations per scenario

add.legend

logical, should legend be added?

yside

side at which y-axis is labelled (2,4)

add.rect

logical, should negative values have grey background shading?

ylab

vertical axis labelling

las,xlas

orientation o y and x axis labelling

title

title for the plot

scenarios

vector of scenario names to be plotted

add.nmod

logical, should number of models and simulations be displayed?

seas

which seasons should be plotted

lwd,lwd2

line width of bars and bar extensions

cex

character expansion for text

legend.pos

placement of legend (see legend)

add

logical, should plot be added to existing plot?

scols,scols2

scenario colours (named vector)

yaxt

character describing y-axis labelling

distance

white space between group of bars

Value

vertical limits of plots (e.g. ylim)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## set up a list of lists with projection data
##
mch <- list()
ach <- list()
for (se in c('DJF', 'MAM', 'JJA', 'SON')){
  for (nm in c('GCM', 'Downscaled')){
    mch[[se]][[nm]] <- quantile(rnorm(100, mean=1, sd=0.5), c(0.1, 0.9, 0.5))
    ach[[se]][[nm]] <- quantile(rnorm(100, mean=1, sd=1), c(0.1, 0.9, 0.5))
  }
}
plot_projbars(mch, ach, seas=names(mch), xlas=1, yside=2)

## set up another list of projected changes
mch <- list()
ach <- list()
mnchange <- c(rcp26=1, rcp45=2, rcp85=3)
for (se in c('DJF', 'MAM', 'JJA', 'SON')){
  for (scen in c('rcp26', 'rcp45', 'rcp85')){
    mch[[se]][[scen]] <- quantile(rnorm(100, mean=mnchange[scen], sd=0.5), c(0.1, 0.9, 0.5))
    ach[[se]][[scen]] <- quantile(rnorm(100, mean=mnchange[scen], sd=1), c(0.1, 0.9, 0.5))
  }
}
plot_projbars(mch, ach, seas=names(mch), xlas=1, yside=2)

jonasbhend/NRMgraphics documentation built on May 19, 2019, 7:26 p.m.