showMultiLinePlotsByVariable: Show Multi-Line Plots by Variable

View source: R/showMultiLinePlotsByVariable.R

showMultiLinePlotsByVariableR Documentation

Show Multi-Line Plots by Variable

Description

Show plots with different regions in the same plot; x-axis variable chosen by user.

Usage

showMultiLinePlotsByVariable(
  data,
  vars,
  xVar,
  scales = "free_y",
  showHistorical = FALSE,
  showGlobal = FALSE,
  nrowNum = 1,
  mainReg = getOption("mip.mainReg"),
  histRefModel = getOption("mip.histRefModel"),
  yearsByVariable = getOption("mip.yearsBarPlot")
)

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.

xVar

A single string. The variable for the x-axis.

scales

A single string. choose either "free_y" or "fixed".

showHistorical

A single logical value. Should historical data be shown? It is not recommended to set this to TRUE as the resulting plot we probably be quite confusing.

showGlobal

A single logical value. Should global data be shown? Default is false to save space in pdf

nrowNum

An integer value. Number of rows of the panel figures

mainReg

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

histRefModel

A named character vector identifying the unique model to be chosen for historical data. Use options(mip.histRefModel=<value>) to set globally.

yearsByVariable

A numeric vector. The years to be marked in the plots. As default it uses the value globally set by options(mip.yearsBarPlot=<value>).

Details

Same as showMultiLinePlots but with the variable specified by xVar on x-axis. For every y-axis-value, we need a unique x-axis-value. For historical data, there may be several sources / models of the same variable. For the x-axis-variable a unique historical source / model is chosen via histRefModel.

Value

NULL is returned invisible.

Example Plots

page 1: showMultiLinePlotsByVariable1.png page 2: showMultiLinePlotsByVariable2.png

Examples

## Not run: 
options(mip.mainReg = "World")
options(mip.yearsBarPlot = c(2010, 2030, 2050, 2100))
options(mip.histRefModel = c("GDP|PPP pCap" = "James_IMF"))
data <- as.quitte(data)
vars <- c(
  "FE|Transport pCap",
  "FE|Buildings pCap",
  "FE|Industry pCap")
showMultiLinePlotsByVariable(data, vars, "GDP|PPP pCap")

## End(Not run)

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