# Plot the results of SSA reconstruction

### Description

Plot the result of SSA Reconstruction step

### Usage

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 36 | ```
## S3 method for class '1d.ssa.reconstruction'
plot(x, ...,
type = c("raw", "cumsum"),
plot.method = c("native", "matplot", "xyplot"),
base.series = NULL,
add.original = TRUE,
add.residuals = TRUE)
## S3 method for class 'toeplitz.ssa.reconstruction'
plot(x, ...,
type = c("raw", "cumsum"),
plot.method = c("native", "matplot", "xyplot"),
base.series = NULL,
add.original = TRUE,
add.residuals = TRUE)
## S3 method for class 'mssa.reconstruction'
plot(x,
slice = list(),
...,
type = c("raw", "cumsum"),
plot.method = c("native", "matplot", "xyplot"),
na.pad = c("left", "right"),
base.series = NULL,
add.original = TRUE,
add.residuals = TRUE)
## S3 method for class '2d.ssa.reconstruction'
plot(x, ...,
type = c("raw", "cumsum"),
base.series = NULL,
add.original = TRUE,
add.residuals = TRUE,
add.ranges,
col = grey(c(0, 1)),
zlim,
at)
## S3 method for class 'nd.ssa.reconstruction'
plot(x, slice, ...)
``` |

### Arguments

`x` |
SSA object holding the decomposition |

`slice` |
for ‘mssa’: list with elements named 'series' and 'components'; for ‘nd.ssa’: list with elements named 'i', 'j', 'k' or 'x', 'y', 'z', 't' or 'd1', 'd2', ... or ‘1', '2', ...; works like ’['-operator, allows one to select which components from the reconstruction of multivariate time series or which subarray from reconstruction of multidimentional array to draw. |

`type` |
Type of the plot (see 'Details' for more information) |

`...` |
Arguments to be passed to methods, such as graphical parameters |

`plot.method` |
Plotting method to use: either ordinary all-in-one via matplot or xyplot, or native plotting method of the input time series |

`na.pad` |
select how to pad the series of unequal length with NA's |

`base.series` |
another SSA reconstruction object, the series of which should be considered as an original. Useful for plotting the results of sequential SSA |

`add.original` |
logical, if 'TRUE' then the original series are added to the plot |

`add.residuals` |
logical, if 'TRUE' then the residuals are added to the plot |

`col` |
color vector for colorscale,
given by two or more colors,
the first color corresponds to the minimal value,
while the last one corresponds to the maximal value (will be interpolated by |

`zlim` |
for 2d-plot, range of displayed values |

`at` |
for 2d-eigenvectors-plot, a numeric vector giving breakpoints along the range of |

`add.ranges` |
logical, if 'TRUE', the range of the components values will be printed in panels captions |

### Details

Additional (non-standard) graphical parameters applicable to 2D SSA plots can be transfered via ...:

- cuts
the number of levels the range of image would be divided into.

- ref
logical, whether to plot zero-level isolines

- symmetric
logical, whether to use symmetric image range scale

- useRaster
logical, indicates whether raster representations should be used. 'TRUE' by default.

- fill.uncovered
single number, matrix, one of the following strings: 'mean', 'original', 'void' or a list of such objects. For shaped 2d-reconstruction-plot this argument defines filling method for uncovered by window array elements on components and residuals plots. If number, all uncovered elements will be replaced by it. If matrix, all uncovered elements will be replaced by corresponding matrix elements. If 'mean', they will be replaced by mean value of current component. If 'original', they will be replaced by corresponding elements of original array. 'void' (by default) means no filling. If list is given, corresponding list element (with recycling) will be used for each plot panel.

- fill.color
color or 'NULL'. Defines background color for shaped 2d-reconstruction plot. If 'NULL', standard white background will be used.

### See Also

`ssa-object`

,
`ssa`

`reconstruct`

,
`plot`

,

### Examples

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 36 37 38 39 40 41 42 43 44 45 46 | ```
# Decompose 'co2' series with default parameters
s <- ssa(co2)
r <- reconstruct(s, groups = list(c(1, 4), c(2, 3), c(5, 6)))
# Plot full 'co2' reconstruction into trend, periodic components and noise
plot(r)
# Artificial image for 2dSSA
mx <- outer(1:50, 1:50,
function(i, j) sin(2*pi * i/17) * cos(2*pi * j/7) + exp(i/25 - j/20)) +
rnorm(50^2, sd = 0.1)
# Decompose 'mx' with default parameters
s <- ssa(mx, kind = "2d-ssa")
# Reconstruct
r <- reconstruct(s, groups = list(1, 2:5))
# Plot components, original image and residuals
plot(r)
# Plot cumulative sum of components only
plot(r, type = "cumsum", add.residuals = FALSE, add.original = FALSE)
# Real example: Mars photo
data(Mars)
# Decompose only Mars image (without backgroud)
s <- ssa(Mars, mask = Mars != 0, wmask = circle(50), kind = "2d-ssa")
# Reconstruct and plot trend
plot(reconstruct(s, 1), fill.uncovered = "original")
# Reconstruct and plot texture pattern
plot(reconstruct(s, groups = list(c(13, 14, 17, 18))))
# Decompose 'EuStockMarkets' series with default parameters
s <- ssa(EuStockMarkets, kind = "mssa")
r <- reconstruct(s, groups = list(Trend = 1:2))
# Plot original series, trend and residuals superimposed
plot(r, plot.method = "xyplot", superpose = TRUE,
auto.key = list(columns = 3),
col = c("blue", "green", "red", "violet"),
lty = c(rep(1, 4), rep(2, 4), rep(3, 4)))
# Plot the series separately
plot(r, plot.method = "xyplot", add.residuals = FALSE,
screens = list(colnames(EuStockMarkets)),
col = c("blue", "green", "red", "violet"),
lty = c(rep(1, 4), rep(2, 4), rep(3, 4)))
# 3D-SSA example (2D-MSSA)
data(Barbara)
ss <- ssa(Barbara, L = c(50, 50, 1))
plot(reconstruct(ss, groups = 1), slice = list(k = 1))
``` |