plot: Plot raster time series

plotR Documentation

Plot raster time series

Description

Plot raster layers corresponding to specified times, or plot extracted time-series values at a location (cell) or a number of cells as a rts object.

Usage


## S4 method for signature 'RasterStackBrickTS,ANY'
plot(x, y, ...)
## S4 method for signature 'rts,ANY'
plot(x, y, ...)

Arguments

x

an object of raster time series class (Raster*TS), or an object of rts class.

y

optional. if x is a Raster*TS object, this item defines time range specifying which layers of raster time series should be plotted. if x is an rts object, this item specifies which column (corresponding to a cell) of time-series data should be plotted (default=1). y='all' indicates all series in rts object should be included in plot.

...

additional argument as in plot in raster package or in graphics package.

Details

If x is a Raster*TS object:

This function, first, selects the layers corresponding to the time range specified in y and then call plot function in raster package to plot the selected raster layers. If y is not specified, all layers will be sent to plot function.

Same as in extract and subset functions, When a raw character vector is used for the y, it is processed as if it was ISO-8601 compliant. This means that it is parsed from left to right, according to the following specification:

CCYYMMDD HH:MM:SS.ss+

A full description will be expanded from a left-specified truncated one.

Additionally, one may specify range-based queries by simply supplying two time descriptions seperated by a forward slash:

CCYYMMDD HH:MM:SS.ss+/CCYYMMDD HH:MM:SS.ss

x can be an rts object. rts is a subclass of xts, created by extract function.

Author(s)

Babak Naimi

naimi.b@gmail.com

https://r-gis.net/

See Also

plot, extract, subset

Examples

## Not run: 
file <- system.file("external/ndvi", package="rts")

ndvi <- rts(file) # read the ndvi time series from the specified file

plot(ndvi,1:4) # plot the first 4 layers in the raster time series

plot(ndvi,"/20010101")

plot(ndvi,"20010101/20010501")

plot(ndvi,"2001-02-01/2001-05-01")

plot(ndvi,"2001-02-01")


n1 <- extract(ndvi,125)# extract the time series values at cell number 125 for all times


plot(n1)

n2 <- extract(ndvi,125,"/20090101") # extract the time series values at cell number 125
# for all times after 2009-01-01

n2

plot(n2)


n3 <- extract(ndvi,125:127,"200901/") # extract the time series values at the specified cell
# numbers for all times before 2009-01

n3

plot(n3) # plot the time-series values for the first series in n3 (i.e cell: 125)

plot(n3,y=1:3) # plot for the 3 series in n3 (i.e cells of 125:127)

plot(n3,y=1:3,col=1)

plot(n3,y=1:3,col=c(1,4,5))

plot(n3,y='all')

## End(Not run)


rts documentation built on Oct. 1, 2023, 9:07 a.m.

Related to plot in rts...