# barplot.tis: Barplot for Time Indexed Series In tis: Time Indexes and Time Indexed Series

## Description

This is `barplot` for `tis` objects. If the first argument to `barplot` is a `tis` object, this function is called. There may be more than one `tis` argument. See details below.

## Usage

 ```1 2``` ```## S3 method for class 'tis' barplot(height, ...) ```

## Arguments

 `height` a `tis` object. There may, however, be more than just one `tis` argument in the call. `...` arguments passed on to `barplot.default`.

## Details

`barplot.tis` constructs a call to `barplot2`. The `tis` arguments, including but not limited to `height`, are pulled out and used to construct a `height` argument for the constructed call, and the `width` argument will be calculated as described below.

If the series sent in are multivariate, i.e., have multiple columns, the constructed `height` argument will also have multiple columns, which is how `barplot` does stacked bar charts. If you supply several multivariate series to `barplot.tis`, all of the series must have the same number of columns.

If the `beside` argument is supplied in the ... list, the `width` argument will be set to `d/(NC + 0.5)`, where `d` is the mean difference in decimal time units (where one year = 1, a quarter = 0.25, and so on) of the series observation times, `NC` is the number of columns in the series arguments, and `space` will be set to `c(0, 0.5)`. The effect of all this will be to make the total width of the barplot match the length (in years) of the series plotted. When combined with the calculated `x.offset` described below, this will make the plot align correctly on the time axis. However, note that the alignment will only really be correct if all of the series plotted have the same frequency, as the underlying `barplot.default` forces each group of bars to have the same width when `beside = TRUE`.

If the series being plotted are of different frequencies, you should not set `beside`, leaving it at the default value of `FALSE`. This will cause the widths of the bars for each series to be inversely proportional to the series frequencies, and the individual observations will align correctly on the time axis.

`barplot.tis` finds the earliest starting date of the `tis` arguments and shifts the plot rightward along the x-axis by that amount, which aligns the first bar with its start date. That is, if `gdp` is the `tis` argument with the earliest start date of all the series being plotted, the plot is shifted rightward to make the first bar align with `time(start(gdp))`.

You can use `tisPlot` to draw axes, axis labels, and tick marks for a `barplot`. First call `tisPlot` with the series you want to plot, and other arguments set to create the range, axes, labels, tick marks and so on that you want, but set `color = 0` to make the series lines invisible. Then call `barplot` with the series and additional `barplot` arguments, but set the `add` argument to `add = TRUE`. This adds the barplot, without axes, to the existing tisPlot.

## Value

same as `barplot.default`.

`barplot`, `barplot2`