waterfall: Generic waterfall plot

Description Usage Arguments Details Examples

Description

Draw a composition of overlapped plots.

Usage

1
2
3
4
5
waterfall(x, build_plot, palette = NULL, bg = "white", col = "black",
  metric = NULL, calc.label = NULL, sort.value = NULL,
  show.labels = F, show.axis = T, show.underline = T,
  hide.outliers = F, title = NULL, bw = "SJ", overlap = 0.4,
  alpha = 0.8, label.expand = 0.15, style.pulsar = F)

Arguments

x

List of vectors which will be displayed. Each list element will be transformed to an individual plot.

build_plot

A function which draws a plot for each vector. This function should have the following signature: 'function(x, x.lims, fill, col, bw, show.underline, alpha)'. There are two predefined functions which can be used: build_density and build_ft.

palette

Palette which will be used for plots. Some palette examples:

  • colorRampPalette(c("red", "orange"))(8),

  • colorRampPalette(c("yellow", "yellow4"))(9),

  • colorRampPalette(c("royalblue", "royalblue4"))(10),

  • colorRampPalette(c("purple", "purple4"))(11),

  • colorRampPalette(c("green2", "green4"))(12)

  • rainbow(7)

The default value is colorRampPalette(c("red", "orange"))(min(10, length(x))).

bg

The background color. The default value is "white".

col

The line color which will be used for axis lines, text labels, and plot contours. The default value is "black".

metric

An optional function which returns a single numeric value for a numeric vector. Can be used in labels (when show.labels is TRUE, the metric value van be used in calc.label) and for sorting order.

calc.label

A function which calculates labels for each plot; should be used with show.labels = TRUE. The function should have the following signature: function(index, name, metric.value). If calc.label is NULL, the following default algorithm will be applied: if an x element has a name label, this name will be used; otherwise if metric is defined, the metric value will be used; otherwise the list index will be used. The default value is NULL.

sort.value

Defines how the individual plots will be sorted. If sort.value is NULL, the plots will not be sorted. If sort.value is "metric" and metric is defined, the plots will be sorted by the given metric function. Otherwise, sort.value should be a function which takes a numeric vector and returns a single numeric value which will be used for sorting. The default value is NULL.

show.labels

When TRUE, labels for each individual plot will be drawn on the right side. The text of the labels is contrlled by the calc.labels function. The default value is FALSE.

show.axis

When TRUE, a horizontal axis with ticks will be drawn at the bottom of the whole waterfall plot. The default value is TRUE.

show.underline

When TRUE, a horiznotal line will be drawn under each individual plot. The default value is TRUE.

hide.outliers

When TRUE, the outlier values will be automatically removed from each x element based on the Tukey's fences. The default value is FALSE.

title

The text for the title.

bw

The smoothing bandwidth to be used. Will be passed to build_plot. The default value is bw.SJ.

overlap

The overlap factor of the individual plots. If overlap is 0, the plots will not be overlapped. If overlap is 1, all the plots will be drawn on the same place. The default value is 0.4.

alpha

The alpha level for the inside area of the each individual plot. The default value is 0.8.

label.expand

The relative expand value for the right side. Will be used only if show.labels is TRUE. The default value is 0.15.

style.pulsar

Applies the plot style which is similar to the iconic plot of a pulsar and the "Unknown Pleasures" Joy Division album cover. If it's true, the values of palette, bg, col, alpha, show.axis, show.underline will be ignored. The default value is FALSE.

Details

Inspired by the series of blog posts by Brendan Gregg.

Examples

1
2
waterfall(rdistrs(5), build_plot = build_density)
waterfall(rdistrs(5), build_plot = build_ft)

AndreyAkinshin/ggwaterfall documentation built on June 23, 2019, 12:01 a.m.