Description Usage Arguments Details Value Note See Also Examples
tisPlot
is a function with dozens of options for creating
high quality time series plots. Can be used with screenPage
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | tisPlot(...,
leftAxis = TRUE, plotType = "l",
lineType = "solid", lineWidth = 1.5,
plotChar = "*", dataCex = 1, color = 1,
midPoints = TRUE, dropNA = FALSE, xOffset = 0,
xAxisMin = NULL, xAxisMax = NULL, xExpandBy = 0.04,
xTickFreq = "Auto", xTickSkip = 0,
xUnlabeledTickFreq = "None", xUnlabeledTickSkip = 0,
xMinorTickFreq = "None", xMinorTickSkip = 0,
dateFormat = "Auto", xCex = 1,
midLabels = FALSE, yearLabels = FALSE,
xAxisLabel = NULL, xSpace = 4, log = FALSE,
leftAxisMin = NULL, leftAxisMax = NULL, leftExpandBy = 0.04,
leftTicks = 5, leftTickLocations = NULL,
labelLeftTicks = FALSE, leftTickLabels = NULL,
rightAxisMin = NULL, rightAxisMax = NULL, rightExpandBy = 0.04,
rightTicks = 5, rightTickLocations = NULL,
labelRightTicks = TRUE, rightTickLabels = NULL,
yCex = 1, extendTopTick = TRUE,
cex = 1,
head = NULL, headAlign = 0.5, headCex = 1.5,
sub = NULL, subCex = 0.85,
leftTopLabel = NULL, rightTopLabel = NULL, topLabelAlign = 0,
labCex = 1,
leftInsideLabel = NULL, rightInsideLabel = NULL,
innerLine = 0.5, innerOffset = 0.05, innerCex = 0.8,
foot = NULL, footColor = "black", footAlign = 0,
footCex = 0.8, footSpace = -1,
tck = 0.03,
axisWidth = 2,
start = 0, end = 0,
boxType = "u",
leftMargin = -1, rightMargin = -1, topMargin = -1, bottomMargin = -1,
nberShade = FALSE, shadeDates = NULL, shadeColor = "gray",
shadeBorder = FALSE, polyArgs = list())
|
... |
any number of univariate or multivariate |
leftAxis |
logical. |
plotType |
type of plot desired. Values are |
lineType |
character or numeric vector specifying the line type for each
series. The default is |
lineWidth |
numeric vector of line widths for the series. The default value is
|
plotChar |
vector of characters (or numbers for plotting symbols – see the
help for |
dataCex |
numeric vector. |
color |
character or numeric vector specifies color for each series. Default is 1, the device default foreground color. |
midPoints |
logical. |
dropNA |
if |
xOffset |
Shifts the data points for series[i] to the right by
|
xAxisMin |
minimum value of the x axis. If non-NULL, this overrides the
calculation described in |
xAxisMax |
maximum value of the x axis. If non-NULL, this overrides the
calculation described in |
xExpandBy |
a single number or two numbers between 0 and 1. |
xTickFreq |
a string like the ones returned by Two special strings can also be given. "none" means no labelled
tick marks, while "auto" tries (not always successfully) to come up
with reasonable tick locations automatically. "auto" also overrides
any The default is "auto". |
xTickSkip |
a number used with |
xUnlabeledTickFreq |
same as |
xUnlabeledTickSkip |
same as |
xMinorTickFreq |
same as |
xMinorTickSkip |
same as |
dateFormat |
format string for x axis date labels. See |
xCex |
|
midLabels |
if |
yearLabels |
if |
xAxisLabel |
text to appear centered under the x axis. Must be a single
character string, multi-line |
xSpace |
lines of space to set aside directly beneath the x-axis to hold
tick, year and/or axis labels. Default is |
log |
if |
leftAxisMin |
minimum value of the left axis. If non-NULL, this overrides the
calculation described in |
leftAxisMax |
maximum value of the left axis. If non-NULL, this overrides the
calculation described in |
leftExpandBy |
a single number or two numbers between 0 and 1. |
leftTicks |
number of ticks to draw on left axis at "pretty" locations. Default
is 5. This argument is ignored if |
leftTickLocations |
if non-NULL, a vector of desired tick locations or a string that
evaluates to such a vector. The default value NULL lets the setting
for |
labelLeftTicks |
If |
leftTickLabels |
character vector of tick labels or NULL (the default). If NULL and
|
rightAxisMin |
minimum value of the right axis. If non-NULL, this overrides the
calculation described in |
rightAxisMax |
maximum value of the right axis. If non-NULL, this overrides the
calculation described in |
rightExpandBy |
a single number or two numbers between 0 and 1. |
rightTicks |
number of ticks to draw on right axis at "pretty" locations. Default
is 5. This argument is ignored if |
rightTickLocations |
if non-NULL, a vector of desired tick locations or a string that
evaluates to such a vector. The default value NULL lets the setting
for |
labelRightTicks |
If |
rightTickLabels |
character vector of tick labels or NULL (the default). If NULL and
|
yCex |
|
extendTopTick |
if |
cex |
the base character expansion factor by which all of the
|
head |
text to appear at the top of the figure region, with alignment
determined by |
headAlign |
number indicating justification for the strings in |
headCex |
|
sub |
text to appear just under |
subCex |
|
leftTopLabel |
text to appear at the top of the left axis, with alignment
determined by |
rightTopLabel |
text to appear at the top of the right axis, with alignment
determined by |
topLabelAlign |
number indicating alignment for the strings in |
labCex |
|
leftInsideLabel |
text to appear left justified and just inside the upper left corner of the plot region. No default. |
rightInsideLabel |
text to appear right justified and just inside the upper right corner of the plot region. No default. |
innerOffset |
number between 0 and 1, a fractional offset for the inside labels.
The left edge of |
innerLine |
Number of lines in from the top edge of the plot to put the first line of the inside labels. |
innerCex |
|
foot |
text to appear at the bottom of the figure region, with alignment
determined by |
footAlign |
number indicating justification for the strings in |
footCex |
|
footColor |
character or numeric vector as long as |
footSpace |
lines of space to set aside directly beneath the space allocated by
|
tck |
The length of |
axisWidth |
line width for the axes and box (if any). Default is 2. |
start |
starting date for the plot. The default is the earliest start time
of all the series. This argument can be supplied in any of the forms
understood by |
end |
end date for the plot. The default is the latest end time
of all the series. This argument can be supplied in any of the forms
understood by |
boxType |
character representing the type of box. Characters |
leftMargin |
lines of space for the left margin. Default value (-1) figures this out automatically. |
rightMargin |
lines of space for the right margin. Default value (-1) figures this out automatically. |
topMargin |
lines of space for the top margin. Default value (-1) figures this out automatically. |
bottomMargin |
lines of space for the bottom margin. Default value (-1) figures this out automatically. |
nberShade |
if |
shadeDates |
a matrix of yyyymmdd dates with two columns named 'Start'
and 'End' that specifies the date ranges to be shaded.
|
shadeColor |
color to shade periods specified by |
shadeBorder |
if shading is being done, this argument tells what color the border
of the shaded areas should be drawn in. It can also be a logical,
in which case |
polyArgs |
additional args that are passed along to the |
leftAxis
, plotType
, lineType
, lineWidth
,
plotChar
, dataCex
, color
and midPoints
are
all cyclically repeated to make them length nSeries
, the number
of series plotted.
Each of the text items head
, sub
, leftTopLabel
,
rightTopLabel
, leftInsideLabel
, rightInsideLabel
,
foot
, and xAxisLabel
can be given as a string, a
collections of strings, or as a string that gets evaluated to one of
the first two. (But xAxisLabel
takes only a single string.)
See the help details for evalOrEcho
to see how this works.
tisPlot
invisibly returns a list of class "tisPlot" and
elements named series
, dateFormat
, plotType
,
lineType
, dataCex
, color
, plotChar
,
lineWidth
, yLegendOffset
, cex
, xRange
,
leftRange
, rightRange
, midPoints
and par
.
This list is useful mostly as an argument to tisLegend
.
The arguments for tisPlot
and its sister function
scatterPlot
have more descriptive names than the corresponding
arguments in plot
. They are also all of unique types, unlike,
for example, the lty
argument in the usual R plotting
functions, which can be either character or numeric. Limiting each
argument to a single type was done to make it easier to design a user
interface to drive the functions.
Use tisLegend
to add legends to a plot created by
tisPlot
or scatterPlot
.
evalOrEcho
, scatterPlot
,
tisLegend
, nberShade
1 2 3 4 5 6 7 8 9 10 11 | firstTis <- tis(cumsum(rnorm(120)), start = c(1996,1), freq = 12)
secondTis <- tis(cumsum(rnorm(120)), start = c(1996,1), freq = 12)
tisPlot(firstTis, secondTis, color = c("red", "green"),
lineType = "solid", head = "Two Random Walks")
tisLegend(legend = c("Random Walk 1", "Random Walk 2"))
series <- tis(cumsum(rnorm(200)), start = c(1960,1), tif = "quarterly")
tisPlot(series, xMinorTickFreq = "annual", nberShade = TRUE,
head = "A Random Walk", sub = "Looks like an econ series",
rightTopLabel = "$Billions")
romerLines()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.