Learn R Programming

tframe (version 2012.3-1)

tfplot: Plot Tframed Objects

Description

Plot tframe or tframed objects.

Usage

tfplot(x, ...)

## S3 method for class 'default': tfplot(x, ..., tf=tfspan(x, ...), start=tfstart(tf), end=tfend(tf), series=seq(nseries(x)), Title=NULL, title=Title, subtitle=NULL, lty = 1:5, lwd = 1, pch = NULL, col = 1:6, cex = NULL, xlab=NULL, ylab=seriesNames(x), xlim = NULL, ylim = NULL, graphs.per.page=5, par=NULL, mar=par()$mar, reset.screen=TRUE, lastObs = FALSE, source = NULL, footnote = NULL, footnoteLeft = footnote, footnoteRight = NULL) tfOnePlot(x, tf=tframe(x), start=tfstart(tf), end=tfend(tf), Title=NULL, title=Title, subtitle=NULL, lty=1:5, lwd=1, pch=NULL, col=1:6, cex=NULL, xlab=NULL, ylab=NULL, xlim=NULL, ylim=NULL, par=NULL, lastObs=FALSE, source=NULL, footnote=NULL, footnoteLeft=footnote, footnoteRight=NULL, legend=NULL, legend.loc="topleft")

Arguments

x
a tframe or tframed object to plot.
...
any additional tframed objects for the same plot.
start
start of plot. (passed to tfwindow)
end
end of plot. (passed to tfwindow)
tf
a tframe or tframed object which can be used to specify start and end.
series
series to be plotted. (passed to selectSeries)
title
string to use for plot title (but see details).
Title
synonym for title.
subtitle
string to use for plot subtitle (but see details).
lty
passed to plot. See also par.)
lwd
passed to plot. See also par.)
pch
passed to plot. See also par.)
col
passed to plot. See also par.)
cex
passed to plot. See also par.)
xlab
string to use for x label (passed to plot).
ylab
string to use for y label (passed to plot).
xlim
passed to plot. See also par.)
ylim
passed to plot. See also par.)
lastObs
Logical indicating if the date of the last observation should be printed below the graph, flushed right.
source
String printed below the graph, flushed left.
footnote
Synonym for footnoteLeft.
footnoteLeft
String printed below lastObs and source, flushed left.
footnoteRight
String printed below lastObs and source, flushed right.
legend
NULL (indicating no legend) or a vector strings to be used for a legend (see legend)
legend.loc
indication of placement of the legend (see legend)
graphs.per.page
integer indicating number of graphs to place on a page.
par
a list of arguments passed to par() before plotting.)
mar
margins passed to plot (deprecated, use par).)
reset.screen
logical indicating if the plot window should be cleared before starting. If this is not TRUE then mar values will have no effect.

Value

  • None.

Side Effects

An object is plotted.

Details

In many cases these are the same as plot methods, however, tfplot puts different series in the object x in different plot panels, whereas plot usually puts them in the same panel. For this reason, tfplot tends to work better when the scale of the different series are very different. If additional objects are supplied, then they should each have the same number of series as x and all corresponding series will be plotted in the same panel. tfplot provides an alternate generic mechanism for plotting time series data. New classes of time series may define there own tfplot (and plot) methods. tfplot does calls to tfOnePlot for each panel. tfOnePlot may give slightly better control, especially in cases where all series are to go on one plot. The functions are intended to provide a convenient way to do some usual things. Ultimately tfOnePlot calls plot, title, and mtext, so even more control of plot details can be acheived by calling those functions directly. The start and end arguments to tfplot determine the start and end of the plot. The argument tf is an alternate way to specify the start and end. It is ignored if start and end are specified.

If xlim and ylim are not NULL they should be a vector of two elements giving the max and min, which are applied to all graphs, or a list of length equal to the number of series to be plotted with each list element being the two element vector for the corresponding plot limits.

The title is not put on the plot if the global option PlotTitles is FALSE. This can be set with options(PlotTitles=FALSE). This provides a convenient mechanism to omit all titles when the title may be added separately (e.g. in Latex). Similarly, options(PlotPlotSubtitles=FALSE), options(PlotSources=FALSE), and options(PlotFootnotes=FALSE) can be used to suppress printing of these. Footnotes can contain "" to produce multiline, or multiple footnotes. However, if source and lastObs are speciied then the overlap can be messy. In this case a better result might be obtained by specifying the source as part of the footnote. If subtitle, source, footnoteLeft or footnoteRight have length less than the number of panels then they are replicated, so typically they should have one element that is applied to each panel, or be vectors with one element for each panel.

See Also

tfprint, tframe, tframed, print, plot, legend, par

Examples

Run this code
tfplot(ts(rnorm(100), start=c(1982,1), frequency=12))
    tfplot(ts(rnorm(100), start=c(1982,1), frequency=12), start=c(1985,6))

Run the code above in your browser using DataLab