Description Usage Arguments Value Examples
Create custom bar(s) / line(s) plot based on user inputs
1 2 3 4 5 |
data |
specification of zoo dataset to use for plot |
inception |
optional boolean to show inception date when set to 'TRUE' |
title |
optional character to add chart title |
no |
optional integer to add chart number |
stacked |
optional boolean to unstack bars when set to FALSE |
space |
optional integer to specify space between bars and data groups, e.g. space = c(0.5, 1); default is space = c(0.1, 0.25) |
c1 |
optional integer vector to specify which columns to plot (as columns) 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' |
plots R base plot
1 2 3 4 5 6 7 8 | Note that these examples require corresponding zoo objects to work properly
BarChart(data = zoo, c1 = 1:3, leg = "topleft", fn = "This is a footnote.", stacked = TRUE, space = 0)
BarChart(data = zoo, c1 = 1:3, leg = "topleft", fn = "This is a footnote.", stacked = FALSE, space = c(0.5, 1))
BarChart(data = zoo, title = "Example Chart", no = "1.1", c1 = 1:3, y1 = "Index", leg = "topleft", dt_format = c("5 years", "%Y"), v = "01/01/2018")
BarChart(data = zoo, title = "Example Chart", c1 = 1:3, y1 = "Index", leg = "topleft", grid = TRUE, h = 0)
BarChart(data = zoo, title = "Example Chart", c1 = 4:5, l2 = 6, y1 = "in %", y2 = "in USD mln", rec = TRUE)
BarChart(data = zoo, title = "Example Chart", c1 = 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.