plot | R Documentation |
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.
## S4 method for signature 'RasterStackBrickTS,ANY'
plot(x, y, ...)
## S4 method for signature 'rts,ANY'
plot(x, y, ...)
x |
an object of raster time series class ( |
y |
optional. if |
... |
additional argument as in |
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.
Babak Naimi
plot
, extract
, subset
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.