showAreaAndBarPlots: Show Area and Bar Plots

View source: R/showAreaAndBarPlots.R

showAreaAndBarPlotsR Documentation

Show Area and Bar Plots

Description

Creates 4 sets of plots from scenario data and shows them.

Usage

showAreaAndBarPlots(
  data,
  vars,
  tot = NULL,
  fill = FALSE,
  orderVars = c("mean", "user", "userRev"),
  mainReg = getOption("mip.mainReg"),
  yearsBarPlot = getOption("mip.yearsBarPlot"),
  scales = "free_y"
)

Arguments

data

A quitte object or an object that can be transformed into a quitte object.

vars

A character vector. The variables to be plotted.

tot

A single string. A total value to be shown in the area plots.

fill

Logical. Should the vars be normalized so that their values add to 1? (Plot shares instead of absolute values.)

orderVars

In what order should the variables be shown?

"mean"

Order by mean value (largest mean at bottom). The default.

"user"

As supplied by the user (first element of vars at top).

"userRev"

Reverse order of the one supplied by the user (first element of vars at bottom).

mainReg

A single string. The plots for this region are shown enlarged. Use options(mip.mainReg=<value>) to set globally.

yearsBarPlot

A numeric vector. The years shown in the bar plots. Use options(mip.yearsBarPlot=<value>) to set globally.

scales

adjusts how axes are harmonized. Default is free_y

Details

Creates 2 sets of area plots (main region + others) and 2 sets of bar plots (main region + others) of the variables specified in vars over time. For area plots, faceting is done by region and scenario; for bar plots over region. If a variables is given in tot, this is shown as a black line. If not the sum of the values of vars is drawn. If fill=TRUE, the values of vars are divided by the values of tot to show share of total. The plots arranged and shown.

Value

NULL is returned invisible.

Example Plots

page 1 - fill=FALSE: showAreaAndBarPlots1.png page 2 - fill=FALSE: showAreaAndBarPlots2.png page 1 - fill=TRUE: showAreaAndBarPlots_fill1.png page 2 - fill=TRUE: showAreaAndBarPlots_fill2.png

Examples

## Not run: 
options(mip.yearsBarPlot = c(2010, 2030, 2050, 2100))
options(mip.mainReg = "World")
data <- as.quitte(data)
vars <- c(
  "FE|CDR",
  "FE|Transport",
  "FE|Buildings",
  "FE|Industry")
showAreaAndBarPlots(data, vars)
showAreaAndBarPlots(data, vars, orderVars = "user")

## End(Not run)

pik-piam/mip documentation built on April 5, 2024, 12:31 p.m.