mirrorbarplot: Function to create a mirrored bar plot. This is two overlaid...

Description Usage Arguments Value

Description

This is normally used to show annual returns for an equity curve overlaid with its associated annual max drawdown.

Usage

1
2
3
4
5
mirrorbarplot(rets, mdd, cex.lab = 1, barcolors = c("red", "green",
  "orange"), cex.axis = 1, cex.legend = 0.8, cex.names = 1,
  cex.main = 1, main = "Mirror Barplot", cex.text = 0.8,
  legend.loc = c(17, -25), yrange = NULL, xmgp = c(3, 1, 0),
  annotateYrs = TRUE, legend.horiz = FALSE, ...)

Arguments

rets

An xts of periodic returns, typically annual returns.

mdd

An xts of periodic maximum drawdowns with the same structure as rets.

barcolors

A vector of 3 colors for the bars. Default red, green, orange.

main

The title text.

legend.loc

The X,Y location of the legend. If NULL, then no legend is plotted.

yrange

The numeric range for the Y axis. Useful to extend / shorten it. NULL will calculate it automatically.

xmgp

See par() for mgp. This moves the title and the axises around.

annotateYrs

Logical. Whether to show the years on the X axis. Note that the period of returns should be years for this to work properly.

legend.horiz

Logical. Passed on as horiz to legend() and used to set the legend horizontally rather than vertically.

cex.<param>

These are the various cex values. cex.lab for the Y-label size, cex.axis for the Y-axis size, cex.legend for the legend size, cex.names for the X-axis label size, cex.main for the title, cex.text for the annotated text on the plot (the average line).

Value

Nothing is returned per se. This function creates a plot.


jeanmarcgp/xtsanalytics documentation built on May 19, 2019, 12:38 a.m.