plot.ts                 package:base                 R Documentation

_P_l_o_t_t_i_n_g _T_i_m_e-_S_e_r_i_e_s _O_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Plotting methods for objects of class `"ts"' or `"mts"'
     (multivariate time-series).

_U_s_a_g_e:

     plot(x, y = NULL, type = "l", frame.plot = axes,
          plot.type = c("multiple", "single"),
          xy.labels = n <= 150, xy.lines = do.lab, panel=lines, ...)

     lines(x, ...)

_A_r_g_u_m_e_n_t_s:

     x,y: time series objects, usually of class `"ts"'.

    type: the type of plot, see `plot'.  When `y' is present, the
          default will depend on `xy.labels', see below.

frame.plot: a function to give the `frame' for each panel.

plot.type: for multivariate time series, should the series by plotted
          separately (with a common time axis) or on a single plot?

xy.labels: logical, indicating if `text()' labels should be used for an
          x-y plot.

xy.lines: logical, indicating if `lines' should be drawn for an x-y
          plot.  Default is true, when labels are drawn as well.

   panel: a `function(x, col, bg, pch, type, ...)' which gives the
          action to be carried out in each panel of the display for
          `plot.type="multiple"'.  The default is `lines'.

     ...: additional graphical arguments, see `plot', `plot.default'
          and `par'.

_D_e_t_a_i_l_s:

     With one principal argument, these functions create time series
     plots, for multivariate series of two kinds depending on
     `plot.type',

     If `y' is present, both `x' and `y' must be univariate, and a
     ``scatter'' plot `y ~ x' will be drawn, enhanced by using `text'
     if `xy.labels' is `TRUE' or `character', and `lines' if `xy.lines'
     is `TRUE'.

_S_e_e _A_l_s_o:

     `ts' for basic time series construction and access functionality.

_E_x_a_m_p_l_e_s:

     ## Multivariate
     z <- ts(matrix(rt(300, df = 3), 100, 3), start=c(1961, 1), frequency=12)
     plot(z)                # multiple
     plot(z, panel=points)  # same with points instead of lines
     plot(z, plot.type="single", lty=1:3)

     ## A phase plot:
     data(nhtemp)
     plot(nhtemp, c(nhtemp[-1], NA), cex = .8, col="blue",
          main = "Lag plot of New Haven temperatures")
     ## a clearer way to do this would be
     library(ts)
     plot(nhtemp, lag(nhtemp, 1), cex = .8, col="blue",
          main = "Lag plot of New Haven temperatures")


     library(ts)

     data(sunspots)
     ## xy.lines and xy.labels are FALSE for large series:
     plot(lag(sunspots, 1), sunspots, pch = ".")

     data(EuStockMarkets)
     SMI <- EuStockMarkets[, "SMI"]
     plot(lag(SMI,  1), SMI, pch = ".")
     plot(lag(SMI, 20), SMI, pch = ".", log = "xy",
          main = "4 weeks lagged SMI stocks -- log scale", xy.lines= TRUE)

     detach("package:ts") 

