plot.Serie: Serie Plotting

Description Usage Arguments Details Plot Styles Usual Graphical Arguments See Also Examples

Description

Plotting method for time-series inheriting from class "Serie".

Usage

1
2
3
4
## S3 method for class 'Serie'
plot(x, y, ...,
  from, to, ylim, dating, date.format, 
  axes=c(T,T,F,F), legend.names, style)

Arguments

x, y

Serie objects.

...

more Serie objects or additional graphical arguments.

from, to

dates from and to which x axis should be plotted. They are used instead the argument xlim. See plot.window

ylim

numeric vector of length 2, giving the y coordinates range. See plot.window

dating

Dating object used to represent tickmarks at x axis. By default it is selected from the commonest datings according to the x value of the lab argument.

date.format

A character string. The default format depends on the selected dating. The standard format is "%Y-%m-%d". See format.POSIXlt.

axes

a logical vector indicating which axes should be drawn.

legend.names

names of the lines that should be shown in the legend. Use a list with length 0 for show default values. See legend.

style

name of a style configuration that defines a set of graphical options. See section Plot Styles.

Details

This plotting method uses internally other graphics methods as: box, axis or line.

Common graphical arguments as col, lwd or lty can be redirected to the corresponding sub-method with one of the following prefixes:

box.

Prefix for drawing the box.

axes.

Prefix for drawing the axes. A vector or a list of options can be used in order to use different options for different axes.

lines.

Prefix for drawing the lines. A vector or a list of options can be used in order to use different options for different lines. The values are used cyclely if there are more lines than options.

Methods title and legend are also internally called. Use the corresponding prefixes to specify their subset of arguments:

title.

Prefix for adding titles and labels. For example: title.main. Note that the graphical properties should be specified as usual, for example: col.main. See par.

legend.

Prefix for customizing the legend. For example, the label color should be specified with legend.text.col. Note, that the legend is drawn when argument legend.names is not missing.

Plot Styles

Currently, only the configuration that imitates TOL plots (style="TOL") is defined. The configuration is:

lab=c(10,5,7), bty="?", las=2, xaxs="i", yaxs="i", lines.lwd=2

When argument bty is assigned as "?", it is replaced according to the axes, drawing a partial box. For example, when the commonest axes ("bottom" and "left") are used, a box "L" is drawn.

Usual Graphical Arguments

bg

background color

bty

a character string which determined the type of box which is drawn. A value of "n" suppresses the box.

col

specification for the default plotting color. See section 'Color Specification' at par.

lines.col

col in combination with prefix line. indicates colors used to draw the lines. By default, usual TOL colors are used. Other lists as rainbow(...) or heat.colors(...) can be used. See Palettes.

col.axis

The color to be used for axis annotation.

col.lab

The color to be used for x and y labels.

col.main, col.sub

Colors to be used for plot main titles and sub-titles.

lab

A numerical vector of the form c(x, y, len) which modifies the default way that axes are annotated. The values of x and y give the (approximate) number of tickmarks on the x and y axes and len specifies the label length. The value for x axis is used to determine the Dating object used to represent the tickmarks. See argument dating.

las

numeric in 0,1,2,3 indicating the style of axis labels: parallel, horizontal, perpendicular or vertical.

lwd

The line width, a positive number, defaulting to 1. Different widths can be used via box.lwd, axes.lwd and lines.lwd.

lty

The line type. Line types can either be specified as an integer (0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash) or as a valid character string. See section 'Line Type Specification' at par.

mar

A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot. The default is c(5, 4, 4, 2) + 0.1. Changing these values may be convenient when title or legend are shown.

mgp

The margin line (in mex units) for the axis title, axis labels and axis line. Note that mgp[1] affects title whereas mgp[2:3] affect axis. The default is c(3, 1, 0). In combination with axes. different options can be specified for each axis.

xaxs, yaxs

style of axis interval calculation to be used for the x and y axes. Main values are "r" (regular) or "i" (internal).

See Also

See par for more details or more graphical options.

See also plot, plot.default.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
s1 <- Serie(rnorm(18), Monthly, Date(2001))
s2 <- Serie(rnorm(12), Monthly, Date(2002))
plot(s1, s2)
plot(s1, s2, style="TOL")
plot(s1, s2, from=Date(2001,7), dating=Monthly, 
  style="TOL", axes.lwd=2, bg="snow2", 
  axes.font.axis=c(3,1), title.main="Example")
plot(s1, s2, s1-s2, dating=Quarterly, date.format="%m'%y", 
  mar=c(3,3,2,2), lines.col=rainbow(5), lines.lwd=2)
plot(s1, s2, style="TOL", mar=c(6,4,2,2), 
  legend.names=c("s1", "s2"))
plot(s1, s2, dating=Quarterly, date.format="%Y\n%m", 
  axes.mgp=list(c(3,2,0),c(3,1,0)), las=1)

tolBasis documentation built on May 2, 2019, 3:44 a.m.