nvareaplot: nv stacked area plot

Description Usage Arguments Value Examples

View source: R/nvarea.r

Description

nv stacked area plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
nvareaplot(
  x,
  nxticks = 10,
  xticklabels = NULL,
  ytickformat = ",.1f",
  interpolate = c("step", "linear", "basis", "step-before", "step-after", "bundle",
    "cardinal", "monotone"),
  controls = FALSE,
  xlim,
  ylim,
  tooltip,
  options
)

Arguments

x

a data frame with at least two columns whose first column contains numeric x-axis values and remaining columns contain stacked area y-axis values.

nxticks

number of x tick marks, set to 0 for none.

xticklabels

either a character-valued function of a single numeric value that converts x-axis values to text, or a vector of labels as long as nxticks.

ytickformat

format numeric tick labels using a d3.format string (d3.js)

interpolate

d3.js plot interpolation option

controls

(logical), if TRUE then show optional interactive plot format controls

xlim

an optional numeric vector of two values of lower and upper x-axis limits

ylim

an optional numeric vector of two values of lower and upper y-axis limits

tooltip

an optional character vector with as many entries as x has rows, the associated entry is displayed when the user's mouse hovers over the corresponding x-xaxis value (assumes that x has distinct x-axis values). The character values may be formatted with HTML formatting.

options

optional additional JavaScript options passed directly to nvd3.js.

Value

An htmlwidget object that is displayed using the object's show or print method. (If you don't see your widget plot, try printing it with the print function.)

Examples

1
2
3
4
5
6
7
data("stackedArea", package="nvd3")
head(stackedArea)  # note POSIX date format in 1st column
nvd3(nvareaplot(stackedArea))

# Now plot with a better x-axis format:
nvd3(nvareaplot(stackedArea, xticklabels=function(x)
             format(as.POSIXct(x, origin="1970-1-1"), "%Y-%m-%d")))

bwlewis/nvd3 documentation built on July 13, 2021, 9:02 p.m.