sPlot: Scatter Plot Time Series

Description Usage Arguments Value Graphical Parameters Examples

Description

splot plots two economic time series against each other, taking into consideration object attributes such as 'units' and 'title'. splot works best with data collecting functions, such as fred in the the recon package.

Usage

1
2
3
4
5
6
sPlot(x, y, by = NULL, data = NULL, title = NULL, xlab = NULL,
  ylab = NULL, time = NULL, ylim = NULL, xlim = NULL, type = "p",
  col = NULL, lwd = 1, lty = NULL, colAxes = NULL, pch = NULL,
  cex = 1, colBG = NULL, bg = colBG, colPlot = NULL, colGrid = NULL,
  theme = "std", reg = NULL, rlwd = lwd + 1, mar = c(4, 4, 2, 1),
  cex.lab = 1, cex.axis = 0.75, las = 0, leg = NULL)

Arguments

x

'xts' object to be plotted on the x-axis

y

'xts' object to be plotted on the y-axis

by

object of factors to be plotted. Only 'cycle' supported for now, which plots by the business cycle

data

data object containing x and x

title

character title of plot

xlab

character label of x-axis

ylab

character label of y-axis

time

time period to restrict plot. Uses 'xts' convention, e.g., '1970-01/1972-06-03'.

ylim

numeric vector of limits on the y-axis

xlim

Date vector of limits on the x-axis

type

'p' for points, 'l' for lines, 'b' for both

col

character vector of color names to use for lines and points

lwd

line width

lty

line type. examples: 'solid', 'dotted', 'dashed'

colAxes

color of plot axes

pch

type of point to use

cex

size of objects in plot

colBG

background color

bg

background color of points

colPlot

color of plot background

colGrid

color of grids

theme

graphical theme of the plot. Only 'std' is supported.

reg

logical or character. Should a regression line by printed? If 'by', then a regression for each category.

rlwd

regression line width

mar

inner margins outside of plot. c(bottom,left,top,right)

cex.lab

size of labels

cex.axis

size of axis

las

tick label orientation on axis

leg

vector of character names to use in the legend. 'auto' uses object attributes

Value

plot of time-series

Graphical Parameters

If NULL, then value is chosen either by theme or with object attributes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
GDP <- fred('GDPC1', as_xts=TRUE)
GDPpot <- fred('GDPPOT', as_xts=TRUE)
GDPgap <- (GDP-GDPpot)/GDPpot*100

urate <- fred('UNRATE', as_xts=TRUE)
un <- fred('NROU', as_xts=TRUE)
cycU <- urate-un

splot(GDPgap, cycU, reg=T)
splot(GDPgap, cycU, by='cycle')

cmann3/econ311 documentation built on May 31, 2019, 1:14 p.m.