LineChart: Create custom line(s) plot

Description Usage Arguments Value Examples

View source: R/LineChart.R

Description

Create custom line(s) plot based on user inputs

Usage

1
2
3
4
5
LineChart(data, inception = FALSE, title = NULL, title_adj = NULL,
  no = "", l1, l2 = "none", y1 = NULL, y2 = NULL,
  y1_def = "none", y2_def = "none", y2_rev = FALSE, fn = NULL,
  fn_adj = NULL, leg = "topleft", grid = FALSE, rec = FALSE,
  dt_format, h1 = "none", v = "none")

Arguments

data

specification of zoo dataset to use for plot

inception

optional boolean to show clipped inception date when set to 'TRUE'

title

optional character to add chart title

title_adj

optional integer to specify title alignment (0: left-align, 1: right-align, NULL: center)

no

optional integer to add chart number

l1

optional integer vector to specify which columns to plot (as lines) on primary y-axis

l2

optional integer vector to specify which columns to plot (as lines) on secondary y-axis

y1

optional character to specify description of primary y-axis

y2

optional character to specify description of secondary y-axis

y1_def

optional number vector to specify start, end, and intervals of primary y-axis, e.g. c(0, 10, 2)

y2_def

optional number vector to specify start, end, and intervals of secondary y-axis, e.g. c(0, 10, 2)

y2_rev

optional boolean to invert secondary y-axis; y2_def needs to be supplied

fn

optional character to add footnote to plot

fn_adj

optional integer to specify alignment of footnote (0: left-align, 1: right-align, NULL: center)

leg

optional character to specify legend position; options are 'topleft', 'center', 'topright', 'left', 'center', 'right', 'bottomleft', 'bottom', 'bottomright'

grid

optional boolean to show grid when set to TRUE

rec

optional boolean to shade recessions when set to TRUE

dt_format

optional character vector to specify date interval and date format of x-axis, e..g dt_format=c('3 months', '%b-%Y')

h1

optional argument to specify horizontal line(s) at specific height

v

optional date to specify vertical date line(s), e.g. v='31/12/2012'

Value

plots R base plot

Examples

1
2
3
4
5
6
7
Note that these examples require corresponding zoo objects to work properly

LineChart(data = zoo, l1 = 1:3, leg = "topleft", fn = "This is a footnote.")
LineChart(data = zoo, title = "Example Chart", no = "1.1", l1 = 1:3, y1 = "Index", leg = "topleft", dt_format = c("5 years", "%Y"), v = "01/01/2018")
LineChart(data = zoo, title = "Example Chart", l1 = 1:3, y1 = "Index", leg = "topleft", grid = TRUE, h = 0)
LineChart(data = zoo, title = "Example Chart", l1 = 4:5, l2 = 6, y1 = "in %", y2 = "in USD mln", rec = TRUE)
LineChart(data = zoo, title = "Example Chart", l1 = 1, l2 = 2, y1 = "Unemployment (%)", y2 = "Budget Balance (%GDP)", y1_def = c(0, 10, 2), y2_def = c(-10,2,2), y2_rev = TRUE, leg = "top", rec = TRUE)

kilianreber/chartbookR documentation built on July 19, 2019, 9:48 a.m.